本文介绍了MVVM Light 上缺少 EventToCommand的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个有用的类似乎从最新的 MVVM Light 版本中消失了,知道为什么或如何解决它吗?

我正在使用 MvvmLightLibs.5.0.1.0,肯定在 MvvmLightLibs.4.1.27.0 上.所以这个问题与一个 EventToCommand Missing For Windows Phone App 无关>

环境:VS2013,WP8.0

解决方案

最终,我在 Galasoft.MvvmLight.Platform 上找到了 EventToCommand 类.我想作为一个多平台框架,程序集的变化是有意义的.

 xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"<i:Interaction.Triggers><i:EventTrigger EventName="点击" ><Command:EventToCommand Command="{Binding Path=MyVM.MyCommand, Source={StaticResource Locator}}"PassEventArgsToCommand="假"命令参数="{绑定}"/></i:EventTrigger></i:Interaction.Triggers>

This helpful class seems to be gone from the latest MVVM Light build, any idea why or how to work around it?

I'm using MvvmLightLibs.5.0.1.0, was definitely there on MvvmLightLibs.4.1.27.0. So this question is not related with one EventToCommand Missing For Windows Phone App

Environment: VS2013, WP8.0

解决方案

Eventually, I found the EventToCommand class on Galasoft.MvvmLight.Platform. I guess the assembly change makes sense being a multi-platform framework.

 xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"

 <i:Interaction.Triggers>
        <i:EventTrigger EventName="Tap" >
            <Command:EventToCommand  Command="{Binding Path=MyVM.MyCommand, Source={StaticResource Locator}}"
                                     PassEventArgsToCommand="False"
                                     CommandParameter="{Binding}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

这篇关于MVVM Light 上缺少 EventToCommand的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-07 01:17