Class VisualStateUtilities
This class provides various platform agnostic standard operations for working with VisualStateManager.
public static class VisualStateUtilities
- Inheritance
-
VisualStateUtilities
- Inherited Members
Methods
GetVisualStateGroups(FrameworkElement)
Gets the value of the VisualStateManager.VisualStateGroups attached property.
public static IList GetVisualStateGroups(FrameworkElement targetObject)
Parameters
targetObjectFrameworkElementThe element from which to get the VisualStateManager.VisualStateGroups.
Returns
GoToState(FrameworkElement, string, bool)
Transitions the control between two states.
public static bool GoToState(FrameworkElement element, string stateName, bool useTransitions)
Parameters
elementFrameworkElementThe element to transition between states.
stateNamestringThe state to transition to.
useTransitionsboolTrue to use a System.Windows.VisualTransition to transition between states; otherwise, false.
Returns
- bool
True if the control successfully transitioned to the new state; otherwise, false.
Exceptions
- ArgumentNullException
Control is null.
- ArgumentNullException
StateName is null.
TryFindNearestStatefulControl(FrameworkElement, out FrameworkElement)
Find the nearest parent which contains visual states.
public static bool TryFindNearestStatefulControl(FrameworkElement contextElement, out FrameworkElement resolvedControl)
Parameters
contextElementFrameworkElementThe element from which to find the nearest stateful control.
resolvedControlFrameworkElementThe nearest stateful control if True; else null.
Returns
- bool
True if a parent contains visual states; else False.