RepeatBehavior Object

Describes how a Timeline repeats its simple duration.

XAML
<object property="repeatBehaviorString" .../>
Scripting
object.property="repeatBehaviorString"

repeatBehaviorString Grammar

Type Grammar Example Example result
Time span [days.]hours:minutes:seconds[.fractionalSeconds] "0:0:15" Will repeat for 15 seconds.
Iterations iterationsx "3x" Will repeat three times.
Literal "Forever" Forever "Forever" Runs continuously.
  • In the grammar above, [] indicates optional values, the [] are not literals. The : (colon) and . (period) characters are both literals, as is the lower-case x in the iterations form.
  • Values for hours can be any integer value between 0 and 23 inclusive. Values for minutes and seconds can be any integer value between 0 and 59 inclusive. The value for days can be very large, but does have an unspecified upper bound. The decimal value for fractionalSeconds (with the decimal point included) must be between 0 and 1.
  • The iterations placeholder in the iterations form is an integer, specifying the number of times that an animation should repeat. The number of iterations is always followed by the literal lower-case character x.
  • Forever is a literal string that holds special meaning for a RepeatBehavior. See Animation Overview.

Properties

Name, Seconds

Methods

Equals, FindName, GetHost, GetValue, SetValue

Remarks

Creating a Duration, KeyTime, RepeatBehavior, or TimeSpan in XAML or in script is only possible through a type conversion syntax when setting a property such as RepeatBehavior that takes one of these types, with the value specified as a string. The string format for specifying a time in each of these types is identical. Duration can also take the literals "Automatic" and "Forever". RepeatBehavior can take the literal "Forever" and also an iterations syntax "iterationsx". The iterations syntax specifies an integer number of the number of times the animation should repeat, immediately followed by the literal lowercase character x (case sensitive).

The main scenario for working with a RepeatBehavior as an object in script is to get or set its Seconds property in order to query or change an existing animation value.

Specifying a RepeatBehavior by only an integer without any time span literal characters such as : or . will result in a RepeatBehavior of that number of days! This is seldom the intended result. Usually you specify animation time spans in seconds. As such, the RepeatBehavior string must include preceding zero values for hours and minutes, along with the appropriate literal : characters as separators between hours, minutes and seconds. For instance, to specify a RepeatBehavior of five seconds, the RepeatBehavior string would be "0:0:5" ("0:0:05" is equivalent).

If the RepeatBehavior was set as "Forever", or was set using the interationsx form, then the value of Seconds will be 0.

See Also

Animation Overview
Duration