Animation with MVVM Template

What is the best way to start the animation when using the MVVM template? In particular, I have a form that has several fields. When the user clicks the save button Button , I would like to show the animation. I was able to achieve this by setting the ShowMessage property and setting it to True, and the DataTrigger takes this value and starts the animation. However, while the animation is still active, I would like the reset form to be in a clean state. So far I have done a reset by subscribing to the Complete event on the Storyboard and resetting the state of the view model on this event.

Ideally, I would like to somehow call the animation from the view model (because saving will be an asynchronous operation), and let the animation complete. Now I won’t succeed, because when I change the value of the ShowMessage property (to reset), the animation stops and does not start until completion.

Does anyone have a better solution?

Thanks!

+7
animation wpf mvvm storyboard datatrigger
source share
1 answer

Two options come to me. The first is VSM, and the second is sticky behavior. The following post from Marlon Grech may be helpful to you: Animation and MVVM .

Hope this helps.

+3
source share

All Articles