Visual State Manager: Some Practical Uses

So I just fell in love…with the Visual State Manager in Silverlight 2.0 Beta 2.

This thing is sweet. You can cleanly manage the visual appearance for various states. Not only does this tool make it ridiculously simple to create animations that alter the state it also provides a tool that makes it easy to review these states and how they look.

The OLD Way:

  1. Wire Up Mouse Event
  2. Obtain Reference of for each state transition from resources
  3. Cast resources as Storyboards
  4. Determine the appropriate future state
  5. Begin the appropriate Storyboard

The NEW Way

  1. Wire Up Mouse Event
  2. Determine the appropriate future state
  3. Tell Visual State Manager to go to the appropriate state

Not only is the new way cleaner, it also makes it easy to invoke state transitions from virtually anywhere, all you need is a reference to the state’s target and the state name. No more carrying references to those storyboards all over the place…YAY!

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