From Property
Collapse the table of content
Expand the table of content

VisualTransition::From Property

 

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

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

public:
property String^ From {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The name of the VisualState to transition from.

The From property is optional. A VisualTransition can be restricted to apply to only certain states or it can be applied any time the control transitions between states. You restrict when a VisualTransition is applied by setting the To and From properties. The following table describes the levels of restriction from most restrictive to least restrictive.

Type of restriction

Value of From

Value of To

From a specified state to another specified state

The name of a VisualState

The name of a VisualState

From any state to a specified state

Not set

The name of a VisualState

From a specified state to any state

The name of a VisualState

Not set

From any state to any other state

Not set

Not set

You can have multiple VisualTransition objects in a VisualStateGroup that refer to the same state, but they will be used in the order that the previous table specifies.

You can change this behavior by creating a new class that inherits from VisualStateManager and overriding the GoToStateCore method.

The following example creates two VisualTransition objects. When the control transitions from the Pressed state to the MouseOver 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 MouseOver state, the other state is used.

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

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

.NET Framework
Available since 4.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft