【发布时间】:2020-04-30 22:09:22
【问题描述】:
我已将 System.Windows.Interactivity.WPF 库与 MVVM Light 一起使用。
我删除了 System.Windows.Interactivity.WPF 库,因为它的发布日期太旧了。并且我安装了 Microsoft.Xaml.Behaviors.Wpf 库并更新了相关内容。
工作进展顺利,除了一个。 问题是如果我使用 Microsoft.Xaml.Behaviors.Wpf 与 MVVMLight 的 EventToCommand 的交互,如下所示,编译器会显示错误。
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>
错误消息是“错误MC3074:XML命名空间'http://www.galasoft.ch/mvvmlight'中没有EventToCommand标签。”
如果我使用 CallMethodAction 或 InvokeCommand Microsoft.Xaml.Behaviors.Wpf 效果很好,但我必须使用 EventToCommand 因为要将参数传递给 Command。
我应该怎么做才能解决这个问题? 谁能告诉我解决办法?
感谢阅读。
【问题讨论】:
标签: wpf eventtocommand