Timeline Timeline Timeline Class

Definition

Defines a duration and other behavior properties for a Windows Runtime animation. Timeline is the base class for Storyboard and all the Windows Runtime animation types, including those from the animation library and those used for custom animations in visual states or page-level XAML.

public class Timeline : DependencyObject, ITimelinepublic class Timeline : DependencyObject, ITimelinePublic Class Timeline Inherits DependencyObject Implements ITimeline
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

Remarks

Timeline defines the Duration property that controls how long an animation runs once started. Timeline also defines these behavior properties, which are common to all animations types, and to Storyboard:

Timeline also defines the Completed event for Storyboard and animations. Handling the Completed event isn't necessary or most UI animation scenarios.

The relationship between Storyboard and the animation types is that a Storyboard is a container that can group multiple animations, and acts as the controller for starting and stopping the contained animations. When you set Timeline properties on a Storyboard as opposed to individual animations within a Storyboard, the Timeline properties set in the Storyboard typically override those from the combined animations. For more info see Storyboarded animations.

Timeline has a strongly typed collection class that is used for properties that take a set of Timeline values, such as Storyboard.Children. For more info see TimelineCollection.

Timeline derived classes

Timeline is the parent class for several immediately derived classes that support the storyboarded animation system and also the built-in library animations. Here are some of the notable derived classes:

Note

Theme transitions don't derive from Timeline, they derive from Transition.

Constructors

Timeline() Timeline() Timeline()

Provides base class initialization behavior for Timeline -derived classes.

protected Timeline()protected Timeline()Protected Sub New()
Attributes

Properties

AllowDependentAnimations AllowDependentAnimations AllowDependentAnimations

Gets or sets a value that determines whether dependent animations should be permitted to run, throughout the app.

public static bool AllowDependentAnimations { get; set; }public static bool AllowDependentAnimations { get; set; }Public Static ReadWrite Property AllowDependentAnimations As bool
Value
bool bool bool

true if animations can run in the app for dependent animation cases. Otherwise, false. The default is true.

Attributes

Remarks

If you want to set this property value to false, do so as part of page or app initialization, for example in an app activation handler. The property is global for the app, and acts like an app setting, even if you set it in a page scope.

A false value for AllowDependentAnimations overrides all cases where EnableDependentAnimation is set to true on individual animations. When AllowDependentAnimations is false, no dependent animation will run in your app, they all act as if EnableDependentAnimation is false on all animations. For animations declared in the app's page XAML, it might seem that it wouldn't be necessary to disable the dependent animations because you have control over them already by not explicitly setting the EnableDependentAnimation properties. But the scenario for AllowDependentAnimations is more for app authors who are consuming controls with control templates that might contain dependent animations within them. Such animations might exist in the visual states, if the control authors didn't follow visual state best practices. (The control templates for default Windows Runtime controls don't have dependent animations, so you won't need to use AllowDependentAnimations if you're only using default XAML controls and default templates.)

Note

If you're using UIElement.CacheMode, you may have unintentionally created dependent animations, even when using default XAML controls; for more info, see UIElement.CacheMode and Optimize animations and media.

See Also

AutoReverse AutoReverse AutoReverse

Gets or sets a value that indicates whether the timeline plays in reverse after it completes a forward iteration.

public bool AutoReverse { get; set; }public bool AutoReverse { get; set; }Public ReadWrite Property AutoReverse As bool
<object AutoReverse="bool"/>
Value
bool bool bool

true if the timeline plays in reverse at the end of each iteration; otherwise, false. The default value is false.

Attributes

AutoReverseProperty AutoReverseProperty AutoReverseProperty

Identifies the AutoReverse dependency property.

public static DependencyProperty AutoReverseProperty { get; }public static DependencyProperty AutoReverseProperty { get; }Public Static ReadOnly Property AutoReverseProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the AutoReverse dependency property.

Attributes

BeginTime BeginTime BeginTime

Gets or sets the time at which this Timeline should begin.

public IReference<TimeSpan> BeginTime { get; set; }public IReference<TimeSpan> BeginTime { get; set; }Public ReadWrite Property BeginTime As IReference<TimeSpan>
<timeline BeginTime="keyTimeString"/>
Value

The start time of the time line. The default value is zero.

If you are programming using C# or Visual Basic, the parameter type of this parameter is projected as System.TimeSpan?(a nullable System.TimeSpan).

Attributes

BeginTimeProperty BeginTimeProperty BeginTimeProperty

Identifies the BeginTime dependency property.

public static DependencyProperty BeginTimeProperty { get; }public static DependencyProperty BeginTimeProperty { get; }Public Static ReadOnly Property BeginTimeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the BeginTime dependency property.

Attributes

Duration Duration Duration

Gets or sets the length of time for which this timeline plays, not counting repetitions.

public Duration Duration { get; set; }public Duration Duration { get; set; }Public ReadWrite Property Duration As Duration
<timeline Duration="[days.]hours:minutes:seconds[.fractionalSeconds]"/>
-or-
<timeline Duration="Automatic" .../>
-or-
<timeline Duration="Forever" .../>
Value
Duration Duration Duration

The timeline's simple duration: the amount of time this timeline takes to complete a single forward iteration. The default value is a Duration that evaluates as Automatic.

Attributes

Remarks

A Duration value has a TimeSpan component.

  • For Visual C++ component extensions (C++/CX), the data value of a Duration is a property named TimeSpan. This has a TimeSpan structure value, and that structure has a field named Duration that reports the duration as an int64 that counts in 100-nanosecond units. TimeSpan doesn't have any methods for getting components of the time in hours:minutes:seconds format.
  • For C# or Microsoft Visual Basic, you can use utility methods of System.TimeSpan to get the duration components in whatever format you want. For example you can get TimeSpan.Hours, TimeSpan.Minutes and TimeSpan.Seconds separately.
  • For more info, see Remarks in the Duration reference topic.
See Also

DurationProperty DurationProperty DurationProperty

Identifies the Duration dependency property.

public static DependencyProperty DurationProperty { get; }public static DependencyProperty DurationProperty { get; }Public Static ReadOnly Property DurationProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Duration dependency property.

Attributes

FillBehavior FillBehavior FillBehavior

Gets or sets a value that specifies how the animation behaves after it reaches the end of its active period.

public FillBehavior FillBehavior { get; set; }public FillBehavior FillBehavior { get; set; }Public ReadWrite Property FillBehavior As FillBehavior
<timeline FillBehavior="HoldEnd"/>
-or-
<timeline FillBehavior="Stop"/>
Value
FillBehavior FillBehavior FillBehavior

A value that specifies how the timeline behaves after it reaches the end of its active period but its parent is inside its active or fill period. The default value is HoldEnd.

Attributes

FillBehaviorProperty FillBehaviorProperty FillBehaviorProperty

Identifies the FillBehavior dependency property.

public static DependencyProperty FillBehaviorProperty { get; }public static DependencyProperty FillBehaviorProperty { get; }Public Static ReadOnly Property FillBehaviorProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the FillBehavior dependency property.

Attributes

RepeatBehavior RepeatBehavior RepeatBehavior

Gets or sets the repeating behavior of this timeline.

public RepeatBehavior RepeatBehavior { get; set; }public RepeatBehavior RepeatBehavior { get; set; }Public ReadWrite Property RepeatBehavior As RepeatBehavior
<timeline RepeatBehavior="repeatBehaviorValue"/>
Value
RepeatBehavior RepeatBehavior RepeatBehavior

An iteration Count that specifies the number of times the timeline should play, a TimeSpan value that specifies the total length of this timeline's active period, or the special value Forever, which specifies that the timeline should repeat indefinitely. The default value is a RepeatBehavior with a Count value of 1, which indicates that the timeline plays once.

Attributes

RepeatBehaviorProperty RepeatBehaviorProperty RepeatBehaviorProperty

Identifies the RepeatBehavior dependency property.

public static DependencyProperty RepeatBehaviorProperty { get; }public static DependencyProperty RepeatBehaviorProperty { get; }Public Static ReadOnly Property RepeatBehaviorProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the RepeatBehavior dependency property.

Attributes

SpeedRatio SpeedRatio SpeedRatio

Gets or sets the rate, relative to its parent, at which time progresses for this Timeline.

public double SpeedRatio { get; set; }public double SpeedRatio { get; set; }Public ReadWrite Property SpeedRatio As double
<timeline SpeedRatio="double"/>
Value
double double double

A finite value greater than 0 that specifies the rate at which time progresses for this timeline, relative to the speed of the timeline's parent. If this timeline is a root timeline, specifies the default timeline speed. The value is expressed as a factor where 1 represents normal speed, 2 is double speed, 0.5 is half speed, and so on. The default value is 1.

Attributes

SpeedRatioProperty SpeedRatioProperty SpeedRatioProperty

Identifies for the SpeedRatio dependency property.

public static DependencyProperty SpeedRatioProperty { get; }public static DependencyProperty SpeedRatioProperty { get; }Public Static ReadOnly Property SpeedRatioProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the SpeedRatio dependency property.

Attributes

Events

Completed Completed Completed

Occurs when the Storyboard object has completed playing.

public event EventHandler Completedpublic event EventHandler CompletedPublic Event Completed
<timeline Completed="eventhandler"/>
Attributes

See Also