Export (0) Print
Expand All

Timeline.Duration Property

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

Namespace: System.Windows.Media.Animation
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public:
property Duration Duration {
	Duration get ();
	void set (Duration value);
}
/** @property */
public Duration get_Duration ()

/** @property */
public void set_Duration (Duration value)

public function get Duration () : Duration

public function set Duration (value : Duration)

<object Duration="Duration" .../>

Property Value

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

Identifier Field

DurationProperty

Metadata properties set to true

None

A timeline's simple duration constitutes the time for a single forward iteration versus the total play time, which includes repetitions.

Default Duration Behavior

The behavior of a Duration structure with a value of Automatic depends on the type of timeline:

Timeline

Behavior

Timeline

Undetermined (Timeline is abstract)

ParallelTimeline,

Storyboard,

TimelineGroup

Expands to fit child timelines

<Type>Animation (Known as a "From/To/By" or "basic" animations)

1 second

<Type>AnimationUsingKeyFrames (Known as key frame animations)

Sum of all key frame KeyTime values

ParallelTimeline and Storyboard are types of TimelineGroup objects. The duration of a TimelineGroup is determined by the duration of its child timelines. For example, the Storyboard below will run for six seconds (duration of 6 seconds) because that is when its last child Timeline (DoubleAnimation) ends.

NoteNote:

Note: code has been omitted from the following examples, which are provided for illustrative purposed only.

[xaml]

...
  <Storyboard>
    <DoubleAnimation Duration="0:0:2" …/>
    <DoubleAnimation Duration="0:0:4" BeginTime="0:0:2" …/>
  </Storyboard> 
...

Examples of <Type>Animations include DoubleAnimation, PointAnimation, ColorAnimation, etc. If no Duration is specified for these types of animations, they will run for one second.

[xaml]

...
  <!-- With no Duration specified, this animation will run for 
       one second -->
  <DoubleAnimation .../>
...

Examples of <Type>AnimationUsingKeyFrames include DoubleAnimationUsingKeyFrames, PointAnimationUsingKeyFrames, etc. If no Duration is specified for these types of animations they will run until all key frames are finished.

[xaml]

...
  <Storyboard>

    <!-- This key frame animation will end at 4.5 seconds
         Because that is when its last KeyFrame KeyTime ends. -->
    <DoubleAnimationUsingKeyFrames ...>
      <LinearDoubleKeyFrame ... KeyTime="0:0:3" />
      <DiscreteDoubleKeyFrame ... KeyTime="0:0:3.5" />
      <DiscreteDoubleKeyFrame ... KeyTime="0:0:4" />
      <DiscreteDoubleKeyFrame ... KeyTime="0:0:4.5" />
    </DoubleAnimationUsingKeyFrames>
  </Storyboard> 
...

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft