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
targetObject
FrameworkElementThe 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
element
FrameworkElementThe element to transition between states.
stateName
stringThe state to transition to.
useTransitions
boolTrue 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
contextElement
FrameworkElementThe element from which to find the nearest stateful control.
resolvedControl
FrameworkElementThe nearest stateful control if True; else null.
Returns
- bool
True if a parent contains visual states; else False.