Class VisualStateManager
Manages states and the logic for transitioning between states for controls.
Inherited Members
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class VisualStateManager : DependencyObject, IDependencyObject
Fields
| Improve this Doc View SourceCustomVisualStateManagerProperty
Identifies the VisualStateManager.CustomVisualStateManager dependency property.
Declaration
public static readonly DependencyProperty CustomVisualStateManagerProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Methods
| Improve this Doc View SourceGetCustomVisualStateManager(FrameworkElement)
Gets the value of the VisualStateManager.CustomVisualStateManager attached property.
Declaration
public static VisualStateManager GetCustomVisualStateManager(FrameworkElement obj)
Parameters
Type | Name | Description |
---|---|---|
FrameworkElement | obj | The element from which to get the VisualStateManager.CustomVisualStateManager. |
Returns
Type | Description |
---|---|
VisualStateManager | The VisualStateManager that transitions between the states of a control. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | obj is null. |
GetVisualStateGroups(FrameworkElement)
Gets the value of the VisualStateManager.VisualStateGroups attached property.
Declaration
public static IList GetVisualStateGroups(FrameworkElement obj)
Parameters
Type | Name | Description |
---|---|---|
FrameworkElement | obj | The element from which to get the VisualStateManager.VisualStateGroups. |
Returns
Type | Description |
---|---|
System.Collections.IList | The collection of VisualStateGroup objects that is associated with the specified object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | obj is null. |
GoToElementState(FrameworkElement, String, Boolean)
Transitions a control's state.
Declaration
public static bool GoToElementState(FrameworkElement stateGroupsRoot, string stateName, bool useTransitions)
Parameters
Type | Name | Description |
---|---|---|
FrameworkElement | stateGroupsRoot | The root element that contains the VisualStateManager. |
System.String | stateName | The new state that the control is in. |
System.Boolean | useTransitions | Whether to use transition animations. |
Returns
Type | Description |
---|---|
System.Boolean | true if the state changed successfully, false otherwise. |
GoToState(Control, String, Boolean)
Transitions the control between two states.
Declaration
public static bool GoToState(Control control, string stateName, bool useTransitions)
Parameters
Type | Name | Description |
---|---|---|
Control | control | The control to transition between states. |
System.String | stateName | The state to transition to. |
System.Boolean | useTransitions | True to use a VisualTransition to transition between states; otherwise, false. |
Returns
Type | Description |
---|---|
System.Boolean | true if the control successfully transitioned to the new state; otherwise, false. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | control is null. |
System.ArgumentNullException | stateName is null. |
GoToStateCore(Control, FrameworkElement, String, VisualStateGroup, VisualState, Boolean)
Transitions a control between states.
Declaration
protected virtual bool GoToStateCore(Control control, FrameworkElement templateRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions)
Parameters
Type | Name | Description |
---|---|---|
Control | control | The control to transition between states. |
FrameworkElement | templateRoot | The root element of the control's ControlTemplate. |
System.String | stateName | The name of the state to transition to. |
VisualStateGroup | group | The VisualStateGroup that the state belongs to. |
VisualState | state | The representation of the state to transition to. |
System.Boolean | useTransitions | true to use a VisualTransition to transition between states; otherwise, false. |
Returns
Type | Description |
---|---|
System.Boolean | true if the control successfully transitioned to the new state; otherwise, false. |
RaiseCurrentStateChanged(VisualStateGroup, VisualState, VisualState, Control)
Raises the CurrentStateChanged event on the specified VisualStateGroup.
Declaration
protected void RaiseCurrentStateChanged(VisualStateGroup stateGroup, VisualState oldState, VisualState newState, Control control)
Parameters
Type | Name | Description |
---|---|---|
VisualStateGroup | stateGroup | The object on which the CurrentStateChanging event. |
VisualState | oldState | The state that the control transitioned from. |
VisualState | newState | The state that the control transitioned to. |
Control | control | The control that transitioned states. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | stateGroup is null or newState is null or control is null. |
RaiseCurrentStateChanging(VisualStateGroup, VisualState, VisualState, Control)
Raises the CurrentStateChanging event on the specified VisualStateGroup.
Declaration
protected void RaiseCurrentStateChanging(VisualStateGroup stateGroup, VisualState oldState, VisualState newState, Control control)
Parameters
Type | Name | Description |
---|---|---|
VisualStateGroup | stateGroup | The object on which the CurrentStateChanging event. |
VisualState | oldState | The state that the control is transitioning from. |
VisualState | newState | The state that the control is transitioning to. |
Control | control | The control that is transitioning states. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | stateGroup is null or newState is null or control is null. |
SetCustomVisualStateManager(FrameworkElement, VisualStateManager)
Sets the value of the VisualStateManager.CustomVisualStateManager attached property.
Declaration
public static void SetCustomVisualStateManager(FrameworkElement obj, VisualStateManager value)
Parameters
Type | Name | Description |
---|---|---|
FrameworkElement | obj | The object on which to set the property. |
VisualStateManager | value | The VisualStateManager that transitions between the states of a control. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | obj is null. |