WP71 MVVMLight 事件触发器无法识别
遵循 Laurent 的升级指南 http://www.galasoft.ch/mvvm/installing/mangobeta/< /a> 从现有的 MVVMLight WP7 项目转到 WP71 项目。我已经正确更改了引用和命名空间。但 XAML 中无法识别 EventTrigger
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<cmd:EventToCommand
Command="{Binding Mode=OneWay, Path=LoadedCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
我在 EventTrigger 元素上收到错误。
改变了吗?
Having followed Laurent's upgrade guide http://www.galasoft.ch/mvvm/installing/mangobeta/ to get from an existing MVVMLight WP7 project to a WP71 project. I have changed the references and namespaces corectly. But the EventTrigger is not recognised in the XAML
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<cmd:EventToCommand
Command="{Binding Mode=OneWay, Path=LoadedCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
I get an error on the EventTrigger element.
Has it changed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我将应用程序从 WP7 升级到 WP7.1(Mango) 时,我遇到了完全相同的问题。问题出在 MVVM Light 二进制文件上。您需要升级到 WP7.1 二进制文件。
Laurent Bugnion ( https://stackoverflow.com/users/12233/lbugnion ) 解释了如何升级 MVVM Light 二进制文件他的网站在这里: http://www.galasoft.ch/mvvm/installing/mangobeta/< /a>
这些是我用来解决问题的基本步骤:
下载最新的从此处下载最新版本。
打开并编译 WP71 项目。
将二进制文件复制到您的 MVVM 二进制位置(在我的例子中为 C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries)
打开您的项目
在 References 文件夹中,删除 GalaSoft.MvvmLight、GalaSoft.MvvmLight.Extras 和 System .Windows.Interactivity。
从文件夹 C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\WP71 添加新引用。
I had this exact same problem when I upgrade my application from WP7 to WP7.1(Mango). The problem was the MVVM Light Binaries. You need to upgrade to the WP7.1 Binaries.
Laurent Bugnion ( https://stackoverflow.com/users/12233/lbugnion ) explains how to upgrade the MVVM Light binaries on his website here: http://www.galasoft.ch/mvvm/installing/mangobeta/
These are the essential steps I used to fix my problem:
Download the most recent version from here.
Open and Compile the WP71 project.
Copy the binaries to your MVVM Binary location (in my case C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries)
Open your project
In the References folder, delete GalaSoft.MvvmLight, GalaSoft.MvvmLight.Extras and System.Windows.Interactivity.
Add the new references from the folder C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\WP71.
升级到 Mango 后我也遇到了类似的问题。就我而言,我在 MenuItem 单击上绑定了 EventToCommand,但您似乎将其绑定在某种加载事件上。您可以尝试在从视图的代码隐藏加载的 evcent 中使用匿名委托。即:
就我而言,我从: 更改
为
I had a similar problem after upgrading to Mango. In my case, I had the EventToCommand binding on a MenuItem click, but you seem to have it on some sort of loaded event. You could try using an anonymous delegate in the loaded evcent from the view's code-bhind. Ie:
In my case, I changed from:
to
我已经解决了这个问题,恢复到了芒果之前的开发环境。
这不是我想要的解决方案,但是 - 不断前进。
I have moved on from this issue, by reverting back to pre-mango dev environment.
Not the solution I wanted, but - onwards and forwards.