MVVM-Trigger Storyboard in Silverlight View Model

I have several storyboards, in my opinion, that I would like to run from ViewModel, if possible. There is an easy way or an elegant way to do this. Here is what I am trying to do.

The user clicks the button → RelayCommand (in ViewModel), then the relay command should play the storyboard. In addition, one more thing, I would also like to run the storyboard animation myself in the ViewModel without any interaction.

    <i:Interaction.Triggers>
 <i:EventTrigger EventName="MouseLeftButtonDown">
    <cmd:EventToCommand Command="{Binding ButtonPress}"                                                     CommandParameterValue="RedButtonLight">
    </cmd:EventToCommand>
         </i:EventTrigger>
          </i:Interaction.Triggers> 
+3
source share
4 answers

I know that a long time ago. But I wrote a detailed blog post about Triggering Storyboards and MVVM.

http://mark.mymonster.nl/2010/12/14/trigger-a-storyboard-on-viewmodel-changes/

+5

- , , , , , .

, (ViewModel), , , , PropertyChanged, . , INotifyPropertyChanged Presentation.

+1

. . DataEventTrigger

, ControlStoryboardAction, , viewmodel .

Your viewmodel can then raise an event as part of the command, or at other times.

+1
source

Here's how you can do this in a mixture without touching the xaml line or code: http://www.basarat.com/2011/05/expression-blend-starting-storyboard.html

0
source

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


All Articles