我在哪里可以找到Galasoft.MvvmLight.WPF45组装?

Bar*_*osa 6 wpf mvvm mvvm-light

我正在使用VS2013 Express.我是WPF和MVVM的新手.我已经使用NuGet将mvvmlight下载到我的项目中.我正在尝试使用GalaSoft_MvvmLight_Command:EventToCommand.据我所知,我必须通过添加命名空间在xaml中添加引用:

xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight"
Run Code Online (Sandbox Code Playgroud)

但是,不幸的是我得到错误,说:

XML命名空间'clr-namespace:GalaSoft.MvvmLight; assembly = GalaSoft.MvvmLight'中不存在标记'EventToCommand'.

我发现了一些信息,我必须包含GalaSoft.MvvmLight.WPF45程序集,但我没有在packages\MvvmLightLibs.5.0.0.1\lib \文件夹中看到这个dll.每个.NET版本都有许多文件夹,但每个程序集名称都相同,没有WPF45 sufix.发生了什么?我在哪里可以找到这个GalaSoft.MvvmLight.WPF45.dll程序集?或者也许在版本5中,名称有些变化?

编辑:使用对象浏览器我发现它EventToCommand位于GalaSoft.MvvmLight.Command名称空间中的GalaSoft.MvvmLight.Platform程序集中.所以我做了

xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"
Run Code Online (Sandbox Code Playgroud)

我现在可以编译项目,但我仍然在xaml中遇到错误(有什么奇怪的):

"EventToCommand"类型的值无法添加到"TriggerActionCollection"类型的集合或字典中

程序集"GalaSoft.MvvmLight.Platform"中的"EventToCommand"类型是使用旧版本的Blend SDK构建的,并且在Windows Presentation Framework 4项目中不受支持.

和xaml编辑器无法正确显示窗口(无效标记).

EDIT2:

无效标记的解决方案.

在我将命名空间更改为xmlns:cmd="http://www.galasoft.ch/mvvmlight"I之后,还将项目的目标框架从4.5更改为3.5.IDE显示一个错误,关于几乎没有针对其他框架的NuGet包,所以我回到4.5 - 它现在神奇地工作;).谢谢大家的帮助.

The*_*fen 4

假设您拥有版本 4.0.0,那么现在在您的 XAML 中它是如何完成的。击败 1 或更高:

xmlns:cmd="http://www.galasoft.ch/mvvmlight"

我在发行说明的底部找到了这一点: http: //www.mvvmlight.net/installing/changes/

Extras 程序集中 GalaSoft.MvvmLight.Command 的详细信息 XmlnsDefinitionAttribute

由于添加了 XmlnsDefinitionAttribute,您可以简化 XAML 中 MVVM Light EventToCommand 操作的包含过程。请参阅下面的之前和之后:

前:

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"

xmlns:cmd="http://www.galasoft.ch/mvvmlight"
x:Class="MvvmLight4.MainPage">
Run Code Online (Sandbox Code Playgroud)

后:

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:cmd="http://www.galasoft.ch/mvvmlight"
x:Class="MvvmLight4.MainPage">
Run Code Online (Sandbox Code Playgroud)