Reputation: 19396
In a WPF aplication, to use a command with MVVM Light I use this:
xmlns:j="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<j:Interaction.Triggers>
<j:EventTrigger EventName="PreviewKeyDown">
<cmd:EventToCommand Command="{Binding SomeCommand}">
</cmd:EventToCommand>
</j:EventTrigger>
</j:Interaction.Triggers>
But in WP8.1 I can't use iteractivity, so I don't know how to use triggers and the EventToCommand.
Thanks.
Upvotes: 1
Views: 241
Reputation: 3129
Something like this?
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="PreviewKeyDown">
<Core:InvokeCommandAction Command="{Binding SomeCommand}"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
Hope this helps.
Upvotes: 2