Table of Contents

Class VisualStateUtilities

Namespace
HeBianGu.Base.WpfBase
Assembly
HeBianGu.Base.WpfBase.dll

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 FrameworkElement

The element from which to get the VisualStateManager.VisualStateGroups.

Returns

IList

GoToState(FrameworkElement, string, bool)

Transitions the control between two states.

public static bool GoToState(FrameworkElement element, string stateName, bool useTransitions)

Parameters

element FrameworkElement

The element to transition between states.

stateName string

The state to transition to.

useTransitions bool

True 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 FrameworkElement

The element from which to find the nearest stateful control.

resolvedControl FrameworkElement

The nearest stateful control if True; else null.

Returns

bool

True if a parent contains visual states; else False.