Редагувати

Поділитися через


VisualTransition.To Property

Definition

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

public:
 property System::String ^ To { System::String ^ get(); void set(System::String ^ value); };
public string To { get; set; }
member this.To : string with get, set
Public Property To As String

Property Value

The name of the VisualState to transition to.

Examples

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" />

Remarks

The To 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.

Applies to