This topic has not yet been rated - Rate this topic

VisualStateManager.GetVisualStateGroups Method

Gets the value of the VisualStateManager.VisualStateGroups attached property.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
public static IList GetVisualStateGroups(
	FrameworkElement obj
)

Parameters

obj
Type: System.Windows.FrameworkElement
The element from which to get the VisualStateManager.VisualStateGroups.

Return Value

Type: System.Collections.IList
The collection of VisualStateGroup objects that is associated with the specified object.
Exception Condition
ArgumentNullException

obj is null.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Result of my connect Bug for empty collection always returned
"VisualStateGroups are usually set on the root of an element's visual tree, not on the element itself."$0 $0 - Jason R. Shaver $0$0 $0 $0$0 $0 $0So even though the VisualStateManager.GoToState method applies to an object, reading back from that object is not necessarily going to yield the response you'd expect.$0
May return empty.
I've registered a Connect bug report since I cannot get this work as expected. The following code, which I expect to be MANGLED by this awful comment editor, returns an empty collection. $0 $0        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // Testing bug in VSM:
            //
            var vsg = VisualStateManager.GetVisualStateGroups(sender as FrameworkElement);$0 $0