如何在MVVM Light v5中使用invokationCommandAction?
我有一个目标是.NET4.5.1的项目。我安装了MVVM Light nuget,管理器安装了MVVM Light的版本5 在这个版本中,我不能使用EventToCommand,我必须使用IncovationCommand,因此我需要将我的axml代码添加到标题中:如何在MVVM Light v5中使用invokationCommandAction?,mvvm,mvvm-light,Mvvm,Mvvm Light,我有一个目标是.NET4.5.1的项目。我安装了MVVM Light nuget,管理器安装了MVVM Light的版本5 在这个版本中,我不能使用EventToCommand,我必须使用IncovationCommand,因此我需要将我的axml代码添加到标题中: xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:core="using:Microsoft.Xaml.Interactions.Core" 以下代码用于
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
以下代码用于向我的控件添加命令:
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="PointerPressed">
<core:InvokeCommandAction
Command="{Binding ShowPositionCommand, Mode=OneWay}"
InputConverter="{StaticResource MouseButtonEventArgsToPointConverter}"
InputConverterParameter="{Binding ElementName=LayoutRoot}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
但是,我得到一个错误,即core:EventTriggerBehavior在Microsoft.Xaml.Interactions.core中不可用
问题是什么?我得到的例子是
是否可以在目标为4.5.1的项目中使用MVVM Light v4.3
谢谢。对于事件触发器,我正在使用以下代码-如果这对您有帮助,请告诉我。 (这是使用MVVMLightVersion5,目标是.NET4.5)
xmlns:j=“clr命名空间:System.Windows.Interactivity;assembly=System.Windows.Interactivity”
这是针对windows 8.1的吗?
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>