Using Visual State Groups

Visual State GroupsJust started using Visual State Groups.  They provide a great way to merge animations of different types.  In this example I have an animation that drops the content of a user control in from the top called ‘Show’ and another one that pulls it back up again when the user is finished with it called ‘Hide’.

However the user control also needs to slide in from the left into four different positions depending on what’s called it.  Without Visual State Groups I would have to add my up/down animations to each left/right animation.

By splitting them up – making sure no animation conflicts – I can run a ‘Show’ animation with any of my five left/right animations.

Awesome

PS. This later caused me problems as I wanted to play one animation from one Visual State Group before the other.  This could only be solved by getting rid of the groups and just changing the left/right alignment programatically.  Still Visual State Groups can have alsorts of advantages even if they weren’t appropriate here.

Advertisements
  1. Hi, Congratulations to the site owner for this marvelous work you’ve done. It has lots of useful and interesting data.

  2. Rather interesting. Has few times re-read for this purpose to remember. Thanks for interesting article. Waiting for trackback

  3. is there any way to have the state the screen is in remain constant even after navigating to a different screen?

      • moefinley
      • October 31st, 2009

      There isn’t any way to do it just within XAML, but you could save the current state in a variable and then load it again with transitions set to false.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: