Modifier

Partager via


VisualTransition Class

Definition

Represents the visual behavior that occurs when a control transitions from one state to another.

public ref class VisualTransition : System::Windows::DependencyObject
[System.Windows.Markup.ContentProperty("Storyboard")]
public class VisualTransition : System.Windows.DependencyObject
[<System.Windows.Markup.ContentProperty("Storyboard")>]
type VisualTransition = class
    inherit DependencyObject
Public Class VisualTransition
Inherits DependencyObject
Inheritance
Attributes

Examples

The following example creates a VisualTransition that specifies that when the user moves the mouse away from the control, the control's border changes to blue, then to yellow, and then to black in 1.5 seconds. For the entire example, see Customizing the Appearance of an Existing Control by Creating a ControlTemplate.

<!--Take one and a half seconds to transition from the
    MouseOver state to the Normal state. 
    Have the SolidColorBrush, BorderBrush, fade to blue, 
    then to yellow, and then to black in that time.-->
<VisualTransition From="MouseOver" To="Normal" 
                      GeneratedDuration="0:0:1.5">
  <Storyboard>
    <ColorAnimationUsingKeyFrames
      Storyboard.TargetProperty="Color"
      Storyboard.TargetName="BorderBrush"
      FillBehavior="HoldEnd" >

      <ColorAnimationUsingKeyFrames.KeyFrames>

        <LinearColorKeyFrame Value="Blue" 
          KeyTime="0:0:0.5" />
        <LinearColorKeyFrame Value="Yellow" 
          KeyTime="0:0:1" />
        <LinearColorKeyFrame Value="Black" 
          KeyTime="0:0:1.5" />

      </ColorAnimationUsingKeyFrames.KeyFrames>
    </ColorAnimationUsingKeyFrames>
  </Storyboard>
</VisualTransition>

Remarks

You can specify the visual behavior of a control when it transitions between states by adding VisualTransition objects. When you create a VisualTransition, you specify one or more of the following:

  • The time it takes for a transition between states to occur by setting the GeneratedDuration property.

  • Additional changes in the control's appearance that occur at the time of the transition by setting the Storyboard property.

  • When the VisualTransition is applied by setting the To and From properties.

Constructors

VisualTransition()

Initializes a new instance of the VisualTransition class.

Properties

DependencyObjectType

Gets the DependencyObjectType that wraps the CLR type of this instance.

(Inherited from DependencyObject)
Dispatcher

Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
From

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

GeneratedDuration

Gets or sets the time that it takes to move from one state to another.

GeneratedEasingFunction

Gets or sets a custom mathematical formula that is used to transition between states.

IsSealed

Gets a value that indicates whether this instance is currently sealed (read-only).

(Inherited from DependencyObject)
Storyboard

Gets or sets the Storyboard that occurs when the transition occurs.

To

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

Methods

CheckAccess()

Determines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearValue(DependencyProperty)

Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier.

(Inherited from DependencyObject)
ClearValue(DependencyPropertyKey)

Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey.

(Inherited from DependencyObject)
CoerceValue(DependencyProperty)

Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(Inherited from DependencyObject)
Equals(Object)

Determines whether a provided DependencyObject is equivalent to the current DependencyObject.

(Inherited from DependencyObject)
GetHashCode()

Gets a hash code for this DependencyObject.

(Inherited from DependencyObject)
GetLocalValueEnumerator()

Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(Inherited from DependencyObject)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetValue(DependencyProperty)

Returns the current effective value of a dependency property on this instance of a DependencyObject.

(Inherited from DependencyObject)
InvalidateProperty(DependencyProperty)

Re-evaluates the effective value for the specified dependency property.

(Inherited from DependencyObject)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. The specific dependency property that changed is reported in the event data.

(Inherited from DependencyObject)
ReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if it exists.

(Inherited from DependencyObject)
SetCurrentValue(DependencyProperty, Object)

Sets the value of a dependency property without changing its value source.

(Inherited from DependencyObject)
SetValue(DependencyProperty, Object)

Sets the local value of a dependency property, specified by its dependency property identifier.

(Inherited from DependencyObject)
SetValue(DependencyPropertyKey, Object)

Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(Inherited from DependencyObject)
ShouldSerializeProperty(DependencyProperty)

Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(Inherited from DependencyObject)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

Applies to