VisualTransition.From property

Applies to Windows and Windows Phone

Gets or sets the name of the VisualState to transition from.

Syntax


public string From { get; set; }


<object From="stateName"/>

XAML Values

stateName

The name of the VisualState to transition from.

Property value

Type: System.String [.NET] | Platform::String [C++]

The name of the VisualState to transition from.

Remarks

A VisualTransition references either one or two named visual states. The From value references the name of a state that should be the current state. The To value references the name of a state that is the new state requested by a GoToState call. These names come from a Name or x:Name attribute string value that is applied to a VisualState as part of its definition in the same VisualStateGroup. Either From or To are a required value for an effective VisualTransition, a VisualTransition that lacks either of these values or uses values that don't match existing states does nothing.

A VisualTransition can reference just a From state, just a To state, or both a From and To state. Omitting either From or To equates to any state. The VisualStateManager uses a precedence logic for which transition to apply whenever visual states change:

  1. If a VisualTransition exists that specifically references the old state as From and the new state as To, use that transition.
  2. Otherwise, if a VisualTransition exists that specifically references the new state as To but does not specify From, use that transition.
  3. Finally, if a VisualTransition exists that specifically references the old state as From but does not specify To , use that transition.

If none of the above apply, no transition runs.

Examples

This example creates two VisualTransition objects. When the control transitions from the "Pressed" state to the "PointerOver" state, the VisualTransition that has both From and To set is used. When the control transitions from a state that is not "Pressed" to the "PointerOver" state, the other state is used.


<!--Take one half second to transition to the PointerOver state.-->
<VisualTransition To="PointerOver" 
                      GeneratedDuration="0:0:0.5" />

<!--Take one hundredth of a second to transition from the
    Pressed state to the PointerOver state.-->
<VisualTransition From="Pressed" To="PointerOver" 
                      GeneratedDuration="0:0:0.01" />


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

VisualTransition

 

 

Show:
© 2014 Microsoft