是否有方法在Microsoft.Xaml.Behaviors.Wpf中使用MVVMLight的EventToCommand?
我使用了System.Windows.Interactivity.WPF库和MVVM Light 我删除了System.Windows.Interactivity.WPF库,因为它的发布日期较旧。我安装了Microsoft.Xaml.Behaviors.Wpf库并更新了相关内容 工作进展顺利,只有一个例外。 问题是,如果我使用Microsoft.Xaml.Behaviors.Wpf与MVVMLight的EventToCommand的交互(如下所示),编译器将显示错误是否有方法在Microsoft.Xaml.Behaviors.Wpf中使用MVVMLight的EventToCommand?,wpf,eventtocommand,Wpf,Eventtocommand,我使用了System.Windows.Interactivity.WPF库和MVVM Light 我删除了System.Windows.Interactivity.WPF库,因为它的发布日期较旧。我安装了Microsoft.Xaml.Behaviors.Wpf库并更新了相关内容 工作进展顺利,只有一个例外。 问题是,如果我使用Microsoft.Xaml.Behaviors.Wpf与MVVMLight的EventToCommand的交互(如下所示),编译器将显示错误 xmlns:i="http
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:mvvm="http://www.galasoft.ch/mvvmlight"
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectedItemChanged">
<mvvm:EventToCommand Command="{Binding CPUSelectedCommand}"
PassEventArgsToCommand="True"
EventArgsConverter="{localConverters:SelectedItemConverter}" />
</i:EventTrigger>
</i:Interaction.Triggers>
xmlns:i=”http://schemas.microsoft.com/xaml/behaviors"
xmlns:mvvm=”http://www.galasoft.ch/mvvmlight"
错误消息为“错误MC3074:XML命名空间“”中没有EventToCommand标记。”
如果我使用CallMethodAction或InvokeCommand Microsoft.Xaml.Behaviors.Wpf,那么效果很好,但是我必须使用EventToCommand,因为要将参数传递给命令
我应该做什么来解决这个问题?
有人能告诉我解决办法吗
谢谢阅读。简短回答:没有
MvvmLight中的EventToCommand
类继承自System.Windows.Interactivity.TriggerAction
,不能添加到Microsoft.Xaml.Behaviors.EventTrigger
的Actions
属性中
因此,您的选择是:
System.Windows.Interactivity.dll
EventToCommand
类型,该类型继承自Microsoft.Xaml.Behaviors.TriggerAction
。您可以从上的现有实现开始谢谢你的回答