![](/img/trans.png)
[英]WP8 MvvmLight namespace missing and EventToCommand doesn't exist
[英]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.