Share via


ColorKeyFrameCollection Object

Represents a collection of ColorKeyFrame objects that can be individually accessed by index.

XAML
<ColorKeyFrameCollection .../>
  oneOrMoreColorKeyFrames
</ColorKeyFrameCollection/>
Scripting
To create an object using scripting, see CreateFromXAML.

XAML Values

oneOrMoreColorKeyFrames One or more ColorKeyFrame object elements that define the key frames for the animation. These can be any mixture of <LinearColorKeyFrame .../>, <DiscreteColorKeyFrame .../>, and <SplineColorKeyFrame .../>.

Properties

Count, Name

Methods

Add, Clear, Equals, FindName, GetHost, GetItem, GetValue, Insert, Remove, RemoveAt, SetValue

Remarks

ColorKeyFrameCollection defines no methods or properties beyond the basic Collection methods and properties. Methods such as Add or GetItem will expect or return objects that are of type ColorKeyFrame. ColorKeyFrame itself is an abstract class, so the items might be DiscreteColorKeyFrame, LinearColorKeyFrame, or SplineColorKeyFrame.

The XAML syntax for properties that use a ColorKeyFrameCollection is an example of an implicit collection syntax, where you can omit an actual ColorKeyFrameCollection object element. Instead, you generally include one or more DiscreteColorKeyFrame, LinearColorKeyFrame, or SplineColorKeyFrame object elements as child elements of a ColorAnimationUsingKeyFrames. For more information about XAML implicit collection syntax, see XAML Syntax Overview. (Explicitly including a ColorKeyFrameCollection object element is permissible XAML syntax, and might be useful if you intend to name the collection in XAML and manipulate its contents through script later.)

Within the ColorKeyFrameCollection, the order of the ColorKeyFrame object elements is not significant for purposes of how the animation runs, because the KeyTime controls the timing and therefore the order in which the key frames are executed. If a ColorKeyFrameCollection is established with XAML, the items in the collection is the same order as the child elements are declared. It is good markup style as well as good coding style to keep the item/element order the same as the KeyTime sequence order.

See Also

Silverlight Key-Frame Animations Overview
Collection
ColorAnimationUsingKeyFrames