繁体   English   中英

在mvvmlight for Windows 8中缺少EventToCommand行为 - 解决?

[英]Missing EventToCommand behaviour in mvvmlight for Windows 8 - Work Around?

问题说这一切真的:)

我正在使用MVVM Light在XAML / C#中编写Windows 8应用程序,我注意到EventToCommand功能尚未实现。

是否有任何人可以建议的工作?

谢谢!

现在,您可以使用Visual Studio 2013行为SDK(XAML)来完成EventToCommand用于执行的操作,而无需使用其他工具(@localJoost的WinRTBehaviors现在在它帮助了我们所有人之后已弃用):

在此输入图像描述

其用途的一个例子如下:

<Slider x:Name="Sl_VolumeSilder">
        <Interactivity:Interaction.Behaviors>
            <Core:EventTriggerBehavior EventName="ValueChanged">
                <Core:InvokeCommandAction Command="{Binding OnSliderValueChangedCommand}" CommandParameter="{Binding ElementName=Sl_VolumeSilder, Path=Value}"/>
            </Core:EventTriggerBehavior>
        </Interactivity:Interaction.Behaviors>
</Slider>

引用交互性和核心的地方:

xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"

查看LocalJoost使用Reactive Extensions编写的EventToCommand行为: http ://dotnetbyexample.blogspot.be/2012/07/a-winrt-behavior-to-mimic-eventtocommand.html

我刚刚就这个问题做了一篇博文,请看我的参赛作品。

http://blog.tattoocoder.com/2012/08/getting-started-w-windows-8-mvvm-light.html

使用来自@localJoost的WinRTBehaviors和Win8nl

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM