Question

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!

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top