VisualTransition::GeneratedEasingFunction Property

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

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

public:
property IEasingFunction^ GeneratedEasingFunction {
	IEasingFunction^ get ();
	void set (IEasingFunction^ value);
}

Property Value

Type: System.Windows.Media.Animation::IEasingFunction
A custom mathematical formula that is used to transition between states.

You can set the GeneratedEasingFunction property to specify the way a transition occurs. For example, you can specify an easing function to accelerate or decelerate the transition. For more information, see Easing Functions.

The following example creates a VisualTransition that causes a Rectangle to move vertically when the user presses the mouse button over the Canvas. The example sets the GeneratedEasingFunction property to a BounceEase object to cause the Rectangle to appear to bounce when it reaches its destination. The VisualTransition that is used when the user releases the button has another BounceEase object to cause the Rectangle to bounce before it returns to its original position.

<Canvas Name="canvasRoot" Background="Tan" Width="100" Height="250"
        MouseDown="Canvas_MouseEvent" MouseUp="Canvas_MouseEvent">

  <VisualStateManager.VisualStateGroups>
    <VisualStateGroup Name="CanvasStates">
      <VisualState Name="CanvasButtonUp" />
      <VisualState Name="CanvasButtonDown">
        <Storyboard>
          <!--The VisualTransition is responsible for animating the
              Rectangle falling. This DoubleAnitmation specifies where
              the Rectangle is when the animation completes.-->
          <DoubleAnimation To="200" 
                           Storyboard.TargetName="myRectangle" 
                           Storyboard.TargetProperty="(Canvas.Top)"/>
        </Storyboard>
      </VisualState>
      <VisualStateGroup.Transitions>
        <VisualTransition To="CanvasButtonUp" GeneratedDuration="00:00:01">
          <VisualTransition.GeneratedEasingFunction>
            <BounceEase Bounces="4" EasingMode="EaseIn" Bounciness="2"/>
          </VisualTransition.GeneratedEasingFunction>
        </VisualTransition>
        <VisualTransition To="CanvasButtonDown" GeneratedDuration="00:00:01">
          <VisualTransition.GeneratedEasingFunction>
            <BounceEase Bounces="3" EasingMode="EaseOut" Bounciness="2"/>
          </VisualTransition.GeneratedEasingFunction>
        </VisualTransition>

      </VisualStateGroup.Transitions>
    </VisualStateGroup>
  </VisualStateManager.VisualStateGroups>

  <Rectangle Name="myRectangle"  
             Canvas.Top="30" Canvas.Left="30"
             Fill="Blue" Width="30" Height="30"/>
</Canvas>

The following example shows the event handler for the MouseDown and MouseUp events. The example calls the GoToElementState method to change the VisualState of the canvas.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft