Gets or sets the length of time for which this timeline plays, not counting repetitions.
Assembly: System.Windows (in System.Windows.dll)
<timeline Duration="[days.]hours:minutes:seconds[.fractionalSeconds]"/> -or- <timeline Duration="Automatic" .../> -or- <timeline Duration="Forever" .../>
In the grammar,  indicates optional values, the  are not literals. The : (colon) and . (period) characters are both literals, and delimit the h:m:s string form of a common timespan, or the optional days and fractionalSeconds values.
Dependency property identifier field: DurationProperty
A timeline's simple duration constitutes the time for a single forward iteration versus the total play time, which includes repetitions.
See Duration for details on the XAML attribute format you use to specify a Duration value, in XAML. Creating a Duration in XAML is possible through a type conversion syntax when setting a property that takes a Duration as an attribute string. Basically, a Duration can be defined as a timespan string, or the special value Automatic.
You can programmatically set a new value for on a running animation, and the value will apply immediately. The new current state of the animation will reflect the progress of the animation that had already run prior to the change, with that same progress applied towards the new . You can get the value programmatically using value=object. syntax. However, if the for an animation is not explicitly set (either programmatically or XAML), then the value of object. will be null. A null value for has the same implied effect on an animation as does a Duration explicitly set to Automatic.
If the AutoReverse property is set to true, the timeline plays for twice the length of time specified by its .
This property applies both to specific animations and to the parent storyboard. For an animation in a storyboard, if you set a other than the default Automatic at the storyboard level, make sure you are not unintentionally clipping the durations of child animations.
Animations cannot have a of Forever. If you set the to Forever, an exception will be thrown.
The duration of a Storyboard 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.
Code has been omitted from the following examples, which are provided for illustrative purposed only.
... <Storyboard> <DoubleAnimation Duration="0:0:2" .../> <DoubleAnimation Duration="0:0:4" BeginTime="0:0:2" .../> </Storyboard> ...
... <!-- With no Duration specified, this animation will run for one second --> <DoubleAnimation .../> ...
Examples of <Type>AnimationUsingKeyFrames include DoubleAnimationUsingKeyFrames, PointAnimationUsingKeyFrames, etc. If no is specified for these types of animations they will run until all key frames are finished.
... <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> ...
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.