VisualStateManager.GoToStateCore Method

Transitions a control between states.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

protected virtual bool GoToStateCore(
	FrameworkElement control,
	FrameworkElement stateGroupsRoot,
	string stateName,
	VisualStateGroup group,
	VisualState state,
	bool useTransitions
)

Parameters

control
Type: System.Windows.FrameworkElement
The control to transition between states.
stateGroupsRoot
Type: System.Windows.FrameworkElement
The root element that contains the VisualStateManager.
stateName
Type: System.String
The name of the state to transition to.
group
Type: System.Windows.VisualStateGroup
The VisualStateGroup that the state belongs to.
state
Type: System.Windows.VisualState
The representation of the state to transition to.
useTransitions
Type: System.Boolean
true to use a VisualTransition object to transition between states; otherwise, false.

Return Value

Type: System.Boolean
true if the control successfully transitioned to the new state; otherwise, false.

The GoToStateCore method performs the logic necessary to appropriately start and stop the storyboards that are associated with a transition. When a control calls GoToState to change its state, the VisualStateManager does the following:

  • First, if the VisualState that the control is transitioning to has a Storyboard, the storyboard begins. Then, if the VisualState that the control is coming from has a Storyboard, the storyboard ends.

  • If the control is already in the stateName state, GoToState takes no action and returns true.

  • If stateName does not exist in the ControlTemplate of control, GoToState takes no action and returns false.

You can implement your own VisualStateManager to provide different logic for transitioning between states. For example, you can change the logic described previously, or you can provide logic to transition between custom animation types. To implement a VisualStateManager, create a class that inherits from VisualStateManager and override the GoToStateCore method. To use the custom class, set the CustomVisualStateManager property to an object of your custom type.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft