VisualTransition.GeneratedDuration Property


Gets or sets the amount of time it takes to move from one state to another, and the time that any implicit transition animations should run as part of the transition behavior.

Equivalent WinUI property: Microsoft.UI.Xaml.VisualTransition.GeneratedDuration.

Duration GeneratedDuration();

void GeneratedDuration(Duration value);
public Duration GeneratedDuration { get; set; }
var duration = visualTransition.generatedDuration;
visualTransition.generatedDuration = duration;
Public Property GeneratedDuration As Duration
<object GeneratedDuration="duration"/>

Property Value


The amount of time it takes to move from one state to another.


This example specifies that the control takes one half second to go into the "PointerOver" state.

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


GeneratedDuration is mainly for controlling implicit transitions. If you want your transition animations to be limited only to the specific animations in your Storyboard, you don't to set a value for GeneratedDuration. Instead, set specific Duration values on the animations in the Storyboard or the main Storyboard element within it. If you do set a GeneratedDuration value, it won't truncate or change any Storyboard with a Duration value; the total length of the transition is the longest Duration value that you've set in the animations for Storyboard, or the GeneratedDuration, whichever is longer.

Implicit transitions

You can define a VisualTransition such that it has a GeneratedDuration, but does not have any specific dependency properties being targeted and animated in its Storyboard value. This creates an implicit transition. Any dependency property that is specifically targeted for animation in either the From or To visual states and thus has different values across the state change will use a generated transition animation. This generated animation transitions between the From state value and the To state value using interpolation, and lasts for the time stated by GeneratedDuration. This only works if there can be a DoubleAnimation, PointAnimation or ColorAnimation on a dependency property, for more info, see Remarks in VisualTransition.

By default, an implicit transition animation uses linear interpolation to animate a value through the GeneratedDuration. You can change the linear interpolation to an interpolation behavior of your choice by setting GeneratedEasingFunction as well as GeneratedDuration on a VisualTransition.

Applies to

See also