Mvvmlight工具包WPF4.5中不存在EventToCommand [英] EventToCommand don't exist in Mvvmlight toolkit WPF4.5

查看:323
本文介绍了Mvvmlight工具包WPF4.5中不存在EventToCommand的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用版本为4.1.26.24928的最新MVVMLight Tookit,并且正在使用WPF 4.5编写程序.

I'm using the latest MVVMLight Tookit at version 4.1.26.24928, and I'm writing a program using WPF 4.5.

现在我无法在VS2012 XAML文件中使用EventToCommand,它说名称空间"clr-namespace:GalaSoft.MvvmLight.Command; assembly = GalaSoft.MvvmLight.WPF45"中不存在"EventToCommand" .

Now I can't use the EventToCommand in VS2012 XAML file, it says "EventToCommand" does not exist in the namespace "clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF45".

我的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,我遇到了类似的问题.我的说:

I had a similar problem, using VS2013. Mine said:

EventToCommand在名称空间" http://www.galasoft.ch/mvvmlight 中不存在"

这听起来像胡说八道,因为一切似乎都匹配……而且该项目在重建/清理/任何操作之后都在运行.

Which sounded like nonsense since everything seemd to match... and the project was runing after rebuild/clean/whatever.

解决方案:

1) 使用NuGet(在解决方案资源管理器中右键单击项目),我卸载了仅MVVM Light Libraries"(它询问是否要卸载相关的CommonServiceLocator,我说:是的,无论如何)

1) Using NuGet (right-click on project in Solution Explorer) I uninstalled the "MVVM Light Libraries only" (it asked if I wanted to uninstalled the related CommonServiceLocator, I said: yes, whatever)

重建,(以防万一)它产生了很多预期的错误,关于EventToCommand的错误仍然存​​在.

Rebuild, (just in case) It gave a lot of errors as expected, the ones about EventToCommand were still there.

2) 现在,我使用NuGet安装了仅MVVM Light Libraries".重建,现在可以工作了.没有错误,没有警告,坚决;-)

2) Using NuGet I now installed the "MVVM Light Libraries only". Rebuilt and now it works. No errors, no warnings, rock on ;-)

这篇关于Mvvmlight工具包WPF4.5中不存在EventToCommand的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆