Bagikan melalui


ColorKeyFrameCollection

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

<ColorKeyFrameCollection .../>
  oneOrMoreColorKeyFrames
</ColorKeyFrameCollection/>

XAML Values

Value

Description

oneOrMoreColorKeyFrames

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

Managed Equivalent

ColorKeyFrameCollection

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 object, so the returned objects might be DiscreteColorKeyFrame, LinearColorKeyFrame, or SplineColorKeyFrame.

The XAML syntax for properties that use a ColorKeyFrameCollection is an example of implicit collection syntax, in which you can omit an actual ColorKeyFrameCollection object element. 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.

In the ColorKeyFrameCollection, the order of the ColorKeyFrame object elements is not significant for purposes of how the animation runs, because the KeyTime property 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 are in 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.

For more information on basic concepts, see Key-Frame Animations. Note that the Key-Frame Animations topic is written primarily for users of the managed API, and may not have code examples or specific information that address the JavaScript API scenarios.