VisualStateManager.RaiseCurrentStateChanged Method

Definition

Raises the CurrentStateChanging event on the specified VisualStateGroup object.

C#
protected void RaiseCurrentStateChanged(System.Windows.VisualStateGroup stateGroup, System.Windows.VisualState oldState, System.Windows.VisualState newState, System.Windows.FrameworkElement control, System.Windows.FrameworkElement stateGroupsRoot);

Parameters

stateGroup
VisualStateGroup

The object that the CurrentStateChanging event occurred on.

oldState
VisualState

The state that the control is transitioning from.

newState
VisualState

The state that the control is transitioning to.

control
FrameworkElement

The control that is transitioning states.

stateGroupsRoot
FrameworkElement

The root element that contains the VisualStateManager.

Exceptions

stateGroupsRoot is null.

-or-

newState is null.

Remarks

When the VisualStateGroup is set on the ControlTemplate of a control, the control parameter is set to the control that owns ControlTemplate. When the VisualStateGroup is set on a FrameworkElement, control is null and you should use the stateGroupsRoot parameter.

Notes to Inheritors

When overriding RaiseCurrentStateChanged(VisualStateGroup, VisualState, VisualState, FrameworkElement, FrameworkElement) in a derived class, be sure to call the base class' RaiseCurrentStateChanged(VisualStateGroup, VisualState, VisualState, FrameworkElement, FrameworkElement) method so that registered delegates receive the event.

Applies to

Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10