如何使用互动:对DatePicker的Interaction.Triggers [英] How do I use Interactivity:Interaction.Triggers on DatePicker

查看:332
本文介绍了如何使用互动:对DatePicker的Interaction.Triggers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绑定SelectedDateChanged的命令,所以我可以把它放在我的视图模型内,但nomatter什么,然后它不会接受这个code

http://pastebin.com/T4q8hQBA

 < D​​atePicker的名称=HistoryDateTimeGrid.Column =1Grid.Row =0的Horizo​​ntalAlignment =中心DisplayDateStart ={绑定路径=起始日期}DisplayDateEnd ={绑定路径=结束日期}SelectedDate ={绑定路径= SelectedDate}>
<交互:Interaction.Triggers>
<交互:EventTrigger中事件名称=SelectedDateChanged>
<助手:InvokeDelegateCommandAction命令={结合DataContext.SaveKategorieCommand,的ElementName = LayoutRoot}CommandParameter ={结合}/>
< /交互性:EventTrigger中>
< / DatePicker的>
 

我知道4号线是错误的,但即使是那些接受行的删除没有,所以我需要包含一个文件或东西互动工作?

这是C#和WPF不是Silverlight的BTW

解决方案

您可能需要添加到您的命名空间声明下列之一:

<$p$p><$c$c>xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

和添加的引用 System.Windows.Interactivity 到项目中。

I am trying to bind SelectedDateChanged to a command so I can place it inside my ViewModel but nomatter what then it wont accept this code

http://pastebin.com/T4q8hQBA

<DatePicker Name="HistoryDateTime" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" DisplayDateStart="{Binding Path=StartDate}" DisplayDateEnd="{Binding Path=EndDate}" SelectedDate="{Binding Path=SelectedDate}" >
<Interactivity:Interaction.Triggers>
<Interactivity:EventTrigger EventName="SelectedDateChanged" >
<Helpers:InvokeDelegateCommandAction Command="{Binding DataContext.SaveKategorieCommand, ElementName=LayoutRoot}" CommandParameter="{Binding}"/>
</Interactivity:EventTrigger>
</DatePicker>

I know line 4 is wrong but even with that removed none of those lines are accepted, so do I need to include a file or something for Interactivity to work?

This is C# and WPF not silverlight btw

解决方案

You probably need to add to your namespace declaration the following one:

xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

And add a reference to System.Windows.Interactivity to your project.

这篇关于如何使用互动:对DatePicker的Interaction.Triggers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆