VisualStateGroup.CurrentState property

Applies to Windows and Windows Phone

Gets the most recently set VisualState from a successful call to the GoToState method.

Syntax


public VisualState CurrentState { get; }

Property value

Type: VisualState

The most recently set VisualState from a successful call to the GoToState method, or null.

Remarks

If GoToState has never been called for the states in a particular VisualStateGroup, CurrentState is null. With correct design of controls and visual state, this shouldn't happen. The control logic for a control should always be able to select one state from a given VisualStateGroup, even if that state is a named state with no specific storyboarded behavior.

Because there are potentially multiple VisualStateGroup sets of visual states for a control, each such VisualStateGroup can report a CurrentState. For example, if you click on a Button with a default control template, the "CommonStates" VisualStateGroup reports a CurrentState of "Pressed", and the "FocusStates" VisualStateGroup reports a CurrentState of "PointerFocused".

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

VisualStateGroup
VisualState
GoToState
CurrentStateChanged
Quickstart: Control templates

 

 

Show:
© 2014 Microsoft