How to do animated view change

Topics: Prism v2 - Silverlight 2
Mar 9, 2009 at 3:48 PM

What tips can you give me to implement view change animation for views which resides in the same view?

There are 2 scenarios (for me):
- View change with "module" change. When the 2 different view is in 2 different modules. Like invoking different commands from a menu bar.
- View change within the same module, when the views are sharing the same viewmodel also.

I'd like to follows these principals:
- Each view has a "dedicated state" in VSM declaration like: "Visible", "Hidden".
- Each view should implement an interface to abstract away the VSM stuff like a "ISupportAnimatedViewChange" and has 2 methods: Show, Hide.

In these method implementations when the state change animation is complete the completed event handler should publish a ViewHideComplete or ViewShowComplete event...

So these are my thoughts, which way should I go?

Mar 9, 2009 at 5:31 PM

Hi Attila,


If I understand correctly you want to show different views in the same region, and only one at a time. In this post, Erwin Van der Valk, developer of the Prism-v2 team, explains how to do this by clicking different buttons (an approach similar to your command bar).


As for the “dedicated state” you could publish an event in the method that shows each of the views and subscribe to it in all views(sort of a ChangeActiveView event). Depending on the sender all views should update their state (only active view is the one publishing the event). You can use the Event Aggregator provided by Prism-v2 for this.


For more information on events:

·         How to: Create and Publish Events

·         How to: Subscribe and Unsubscribe to Events


Please let me know if this helps.


Damian Schenkelman

Mar 9, 2009 at 7:27 PM
Hi Damian!

Thanks, so what you wrote confirms my thoughts, so I'll go that way and also read Erwin's post :-)

I'm familiar with the principals and components of CAL we're just in the middle of a SL app dev with CAL.