【发布时间】:2014-10-20 14:39:05
【问题描述】:
我有一个目标是 .NET 4.5.1 的项目。我安装 MVVM Light nuget,经理安装 MVVM Light 5 版。
在这个版本中我不能使用 EventToCommand,我必须使用 incovationCommandAction,所以我需要在我的 axml 标题中添加这段代码:
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 中不可用。
问题出在哪里?我得到的例子from this link
是否可以在目标为 4.5.1 的项目中使用 MVVM Light v4.3?
谢谢。
【问题讨论】:
-
这适用于 windows 8.1 吗?
标签: mvvm mvvm-light