0

I'm trying to make visual states available in the ViewModel as some sort of enumeration (so that I don't have to use string literals or manually create and update static properties in order to be able to control states), and I accidentally found out that Silverlight actually generates internal VisualStateGroup properties in the g.i.cs classes which I could perhaps use.

So my question is what would be the best way to expose these VisualStateGroups and the actual visual states in them as static getters? Extending UserControl could work perhaps, but if possible I'd prefer do be able to do it on demand with an AttachedProperty, any ideas about the pros / cons or even workability of these approaches?

Thanks in advance!

dain
  • 6,475
  • 1
  • 38
  • 47

1 Answers1

1

I support this in Jounce (http://jounce.codeplex.com/) and you can view the source. Also take a look here where I describe how to iterate the visual state manager and hook into various events and iterate the states and transitions:

http://csharperimage.jeremylikness.com/2011/01/visual-state-manager-explained.html

Jeremy Likness
  • 7,531
  • 1
  • 23
  • 25
  • Thanks a lot Jeremy, really appreciate your input, already found great pointers! Your Jounce docs ( http://csharperimage.jeremylikness.com/2011/01/jounce-part-10-visual-state-manager.html ) and the referenced Page Brooks post ( http://pagebrooks.com/archive/2008/11/05/finding-a-storyboard-in-the-visualstatemanager.aspx ) gave me a great start, now only have to figure out a way to make the visual state and group collection property generation automatic for usercontrols and bind to the VM :) PS: I think the VSMExplorer.zip on your link only contains web project or I might have missed something? – dain Feb 15 '11 at 12:35