Represents the duration of time that a Timeline is active.
Assembly: System.Windows (in System.Windows.dll)
<object property="[days.]hours:minutes:seconds[.fractionalSeconds]"/> -or- <object property="Automatic" .../> -or- <object property="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.
Thetype exposes the following members.
|Add||Adds the value of the specified to this .|
|Compare||Compares one value to another.|
|Equals(Duration)||Determines whether a specified is equal to this .|
|Equals(Object)||Determines whether a specified object is equal to a . (Overrides ValueType.Equals(Object).)|
|Equals(Duration, Duration)||Determines whether two values are equal.|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Gets a hash code for this object. (Overrides ValueType.GetHashCode().)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|Plus||Adds one to this .|
|Subtract||Subtracts the specified from this .|
|ToString||Converts a to a String representation. (Overrides ValueType.ToString().)|
|Addition||Adds two values together.|
|Equality||Determines whether two cases are equal.|
|GreaterThan||Determines if one is greater than another.|
|GreaterThanOrEqual||Determines whether a is greater than or equal to another.|
|Implicit(TimeSpan to Duration)||Implicitly creates a from a given TimeSpan.|
|Inequality||Determines if two cases are not equal.|
|LessThan||Determines if a is less than the value of another instance.|
|LessThanOrEqual||Determines if a is less than or equal to another.|
|Subtraction||Subtracts the value of one from another.|
|UnaryPlus||Returns the specified .|
Specifying a by only an integer without any time span literal characters such as : or . will result in a of that number of days! This is seldom the intended result. Usually you specify animation durations in seconds. As such, the string must include preceding 0 values for hours and minutes, along with the appropriate literal : characters as separators between hours, minutes and seconds. For instance, to specify a of five seconds, the string would be "0:0:5" ("0:0:05" is equivalent).
can be set on either a Storyboard or an animation.
Automatic and Forever
Automatic and Forever are values that hold special meaning for a Duration property value, and are represented by the static properties Automatic and Forever in the managed API for Silverlight. For details, see Animation Overview.
The Automatic value applied in either XAML or code results in different behavior on the Storyboard as opposed to an animation. For Storyboard, the Automatic duration time behavior is equal to the end time of its latest ending child animation, such that no clipping of any of the child animation durations occurs. For animations, the Automatic duration is a time span of 1 second (0:0:1). This short duration is seldom desirable, but this default provides you the opportunity to see the animation start during testing. This is better debugging information than never having the animation run, as would occur with a 0 duration.
A of Forever for an animation is part of a deprecated usage, and is seldom used. A of Forever would result in an animation that never advanced from its starting value, no matter what values were provided for From/To, key frames, and so on. If you want an animation to repeat continuously, use RepeatBehavior="Forever", not Duration="Forever".
does not support an object element syntax for Silverlight XAML, and you cannot declare a as a resource dictionary item in XAML. In XAML you should always specify -type properties in the attribute syntax shown here.
In the managed API, you can create a using the constructors.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.