StoryBoards And ViewModels

Topics: Prism v2 - Silverlight 2
Apr 24, 2009 at 5:41 PM
How would you trigger a storyboard event from a viewmodel?
Apr 24, 2009 at 8:16 PM

Hi RobbSmith,


The usual way to start animations is by calling the begin method on the storyboard instance:

In the View:



The way the viewModel and the view interact depends on your actual implementation. If you are following the How to: Create a View with a Presenter document (although it is for MVP it can be applied for MVVM), the usual way to start the animation from the viewModel would be adding a method in the view interface (for example public void StartAnimation()) and implement it with the code before. Then the viewModel will call the StartAnimation() method of the view's reference:

In the viewModel:



You might find the following pattern articles useful from the Prism-v2 documentation:

·         Separated Presentation

o   Supervising Controller

o   Presentation Model


Hope it helps!


Matias Bonaventura