locked
Access visual states from code-behind RRS feed

  • Question

  • I have created a UserControl that has some associated visual states.  I have successfully used GoToStateAction to activate those states from controls within the UserControl and from controls in the hosting application.

    However, I anticipate my app will require more complex interactions that might be best accomplished by accessing the visual states from the code-behind. My C# skills are still pretty limited. Can someone give me an idea of the syntax for accessing the visual states of an object from the code, particularly from the parent application that contains the UserControl with the visual states?
    Thursday, December 17, 2009 6:31 PM

All replies

  • The VisualStateManager class has some static methods which my helpfull for you.

    e.g. GetVisualStateGroups returns the the VisualStateGroups for a given FrameworkElement.

    Hope that helps.
    Monday, December 21, 2009 7:15 PM
  • Thanks Gunter. I'll look into this.
    Wednesday, December 30, 2009 9:16 PM