Timeline Timeline Timeline Class

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.

Syntax

Declaration

public class Timelinepublic class TimelinePublic Class Timeline

Inheritance Hierarchy

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 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 summary

Provides base class initialization behavior for Timeline -derived classes.

Properties summary

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

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

Identifies the AutoReverse dependency property.

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

Identifies the BeginTime dependency property.

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

Identifies the Duration dependency property.

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

Identifies the FillBehavior dependency property.

Gets or sets the repeating behavior of this timeline.

Identifies the RepeatBehavior dependency property.

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

Identifies for the SpeedRatio dependency property.

Events summary

Occurs when the Storyboard object has completed playing.

Constructors

  • Timeline()
    Timeline()
    Timeline()
    Timeline()

    Provides base class initialization behavior for Timeline -derived classes.

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

Properties

  • AllowDependentAnimations
    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 boolpublic static bool AllowDependentAnimations { get; set; }

    Property Value

    • bool
      bool
      bool

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

    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 CacheMode, you may have unintentionally created dependent animations, even when using default XAML controls; for more info, see CacheMode and Optimize animations and media.

  • AutoReverse
    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 boolpublic bool AutoReverse { get; set; }
    <object AutoReverse="bool"/>
    

    Property Value

    • bool
      bool
      bool

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

  • AutoReverseProperty
    AutoReverseProperty
    AutoReverseProperty
    AutoReverseProperty

    Identifies the AutoReverse dependency property.

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

    Property Value

  • BeginTime
    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>public IReference<TimeSpan> BeginTime { get; set; }
    <timeline BeginTime="keyTimeString"/>
    

    Property 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).

  • BeginTimeProperty
    BeginTimeProperty
    BeginTimeProperty
    BeginTimeProperty

    Identifies the BeginTime dependency property.

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

    Property Value

  • Duration
    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 Durationpublic Duration Duration { get; set; }
    <timeline Duration="[days.]hours:minutes:seconds[.fractionalSeconds]"/>
    -or-
    <timeline Duration="Automatic" .../>
    -or-
    <timeline Duration="Forever" .../>
    

    Property Value

    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.
  • DurationProperty
    DurationProperty
    DurationProperty
    DurationProperty

    Identifies the Duration dependency property.

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

    Property Value

  • FillBehavior
    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 FillBehaviorpublic FillBehavior FillBehavior { get; set; }
    <timeline FillBehavior="HoldEnd"/>
    -or-
    <timeline FillBehavior="Stop"/>
    

    Property Value

    • 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.

  • FillBehaviorProperty
    FillBehaviorProperty
    FillBehaviorProperty
    FillBehaviorProperty

    Identifies the FillBehavior dependency property.

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

    Property Value

  • RepeatBehavior
    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 RepeatBehaviorpublic RepeatBehavior RepeatBehavior { get; set; }
    <timeline RepeatBehavior="repeatBehaviorValue"/>
    

    Property Value

    • 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.

  • RepeatBehaviorProperty
    RepeatBehaviorProperty
    RepeatBehaviorProperty
    RepeatBehaviorProperty

    Identifies the RepeatBehavior dependency property.

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

    Property Value

  • SpeedRatio
    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 doublepublic double SpeedRatio { get; set; }
    <timeline SpeedRatio="double"/>
    

    Property 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.

  • SpeedRatioProperty
    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 DependencyPropertypublic static DependencyProperty SpeedRatioProperty { get; }

    Property Value

Events

  • Completed
    Completed
    Completed
    Completed

    Occurs when the Storyboard object has completed playing.

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

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ComposableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Media.Animation.dll