Missing EventToCommand behavior in mvvmlight for Windows 8 - Work?

The question says it all :)

I am writing a Windows 8 application in XAML / C # using MVVM Light, and I noticed that the EventToCommand function has not yet been implemented.

Is there any work for this anyone can offer?

thanks!

+6
source share
3 answers

Check out the EventToCommand behavior written by LocalJoost that uses Reactive Extensions: http://dotnetbyexample.blogspot.be/2012/07/a-winrt-behavior-to-mimic-eventtocommand.html

+4
source

Now you can accomplish what EventToCommand used, using the Behaviors SDK (XAML) for Visual Studio 2013 without using other tools (@localJoost WinRTBehaviors is now not recommended after he helped all of us at these moments):

enter image description here

An example of its use may be the following:

<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> 

Where interactivity and core are indicated:

 xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core" 
+14
source

I just wrote a blog post on this exact issue by looking at my post here.

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

Uses WinRTBehaviors and Win8nl from @localJoost

+2
source

Source: https://habr.com/ru/post/923193/


All Articles