如何使用互动:对DatePicker的Interaction.Triggers互动、如何使用、DatePicker、Interaction

由网友(高脚杯。有你的痕迹)分享简介:我想绑定SelectedDateChanged的命令,所以我可以把它放在我的视图模型内,但nomatter什么,然后它不会接受这个code http://pastebin.com/T4q8hQBA < D​​atePicker的名称=HistoryDateTimeGrid.Column =1Grid.Row =...

我想绑定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号线是错误的,但即使是那些接受行的删除没有,所以我需要包含一个文件或东西互动工作?

bootstrap datepicker 如何使用

这是C#和WPF不是Silverlight的BTW

解决方案

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

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.

阅读全文

相关推荐

最新文章