我正在使用最新的 MVVM Light Toolkit 版本 4.1.26.24928,并且正在使用 WPF 4.5 编写程序。
现在我无法在 VS2012 XAML 文件中使用 EventToCommand,它说命名空间“clr-namespace:GalaSoft.MvvmLight.Command; assembly=GalaSoft.MvvmLight.WPF45”中不存在“EventToCommand”.
我的dll参考是:
System.Windows.Interactivity (v4.5.0.0)
Galasoft.MvvmLight.WPF45 (v4.1.26.24928)
Galasoft.MvvmLight.Extras.WPF45 (v4.1.26.24928)
这是我的代码:
命名空间:
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF45"
文本块:
<TextBlock>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
<cmd:EventToCommand></cmd:EventToCommand>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBlock>
我是不是做错了什么?谢谢!
我也遇到过类似的问题,使用VS2013。我的说:
命名空间中不存在 EventToCommand "http://www.galasoft.ch/mvvmlight http://www.galasoft.ch/mvvmlight"
这听起来像是无稽之谈,因为一切似乎都匹配......并且该项目在重建/清理/其他之后正在运行。
Solution:
1)
使用 NuGet(在解决方案资源管理器中右键单击项目)我卸载了“仅限 MVVM Light Libraries”(它询问我是否要卸载相关的 CommonServiceLocator,我说:是的,无论如何)
重建,(以防万一)它按照预期给出了很多错误,有关 EventToCommand 的错误仍然存在。
2)
现在,我使用 NuGet 安装了“仅 MVVM Light Libraries”。重建后现在可以使用了。没有错误,没有警告,继续前进;-)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)