开发者

How do I use Interactivity:Interaction.Triggers on DatePicker

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="HistoryDate开发者_如何学JAVATime" 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.


For Windows-8.1 application development we should add below line

xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜