.NET Framework Class Library ObjectAnimationUsingKeyFrames Class

Inheritance Hierarchy
Namespace:
System.Windows.Media.Animation
Assembly:
PresentationCore (in PresentationCore.dll) XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

Syntax
<ContentPropertyAttribute("KeyFrames")> _
Public Class ObjectAnimationUsingKeyFrames _
Inherits ObjectAnimationBase _
Implements IKeyFrameAnimation, IAddChild
[ContentPropertyAttribute("KeyFrames")]
public class ObjectAnimationUsingKeyFrames : ObjectAnimationBase,
IKeyFrameAnimation, IAddChild
[ContentPropertyAttribute(L"KeyFrames")]
public ref class ObjectAnimationUsingKeyFrames : public ObjectAnimationBase,
IKeyFrameAnimation, IAddChild
[<ContentPropertyAttribute("KeyFrames")>]
type ObjectAnimationUsingKeyFrames =
class
inherit ObjectAnimationBase
interface IKeyFrameAnimation
interface IAddChild
end
XAML Object Element Usage
<ObjectAnimationUsingKeyFrames>
KeyFrames
</ObjectAnimationUsingKeyFrames>
The ObjectAnimationUsingKeyFrames type exposes the following members.

Constructors

Properties

Methods
|
| Name | Description |
|---|
.gif) | AddChild | Adds a child ObjectKeyFrame to this ObjectAnimationUsingKeyFrames. | .gif) | AddText | Adds a text string as a child of this ObjectAnimationUsingKeyFrames. | .gif) | AllocateClock | Creates a Clock for this AnimationTimeline. (Inherited from AnimationTimeline.) | .gif) | ApplyAnimationClock(DependencyProperty, AnimationClock) | Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the SnapshotAndReplace handoff behavior is used. (Inherited from Animatable.) | .gif) | ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) | Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the specified HandoffBehavior is used. (Inherited from Animatable.) | .gif) | BeginAnimation(DependencyProperty, AnimationTimeline) | Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the SnapshotAndReplace handoff behavior is used. (Inherited from Animatable.) | .gif) | BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior) | Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the specified HandoffBehavior is used. (Inherited from Animatable.) | .gif) | CheckAccess | Determines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.) | .gif) | ClearValue(DependencyProperty) | Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.) | .gif) | ClearValue(DependencyPropertyKey) | Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.) | .gif) | Clone | Creates a modifiable clone of this ObjectAnimationUsingKeyFrames, making deep copies of this object's values. When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values. | .gif) | CloneCore | Makes this instance a deep copy of the specified ObjectAnimationUsingKeyFrames. When copying dependency properties, this method copies resource references and data bindings (but they might no longer resolve) but not animations or their current values. (Overrides Freezable..::.CloneCore(Freezable).) | .gif) | CloneCurrentValue | Creates a modifiable clone of this ObjectAnimationUsingKeyFrames object, making deep copies of this object's current values. Resource references, data bindings, and animations are not copied, but their current values are. | .gif) | CloneCurrentValueCore | Makes this instance a modifiable deep copy of the specified ObjectAnimationUsingKeyFrames using current property values. Resource references, data bindings, and animations are not copied, but their current values are. (Overrides Freezable..::.CloneCurrentValueCore(Freezable).) | .gif) | CoerceValue | Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject. (Inherited from DependencyObject.) | .gif) | CreateClock()()() | Creates a new AnimationClock from this AnimationTimeline. (Inherited from AnimationTimeline.) | .gif) | CreateClock(Boolean) | Creates a new Clock from this Timeline and specifies whether the new Clock is controllable. If this Timeline has children, a tree of clocks is created with this Timeline as the root. (Inherited from Timeline.) | .gif) | CreateInstance | Initializes a new instance of the Freezable class. (Inherited from Freezable.) | .gif) | CreateInstanceCore | Creates a new instance of ObjectAnimationUsingKeyFrames. (Overrides Freezable..::.CreateInstanceCore()()().) | .gif) | Equals | Determines whether a provided DependencyObject is equivalent to the current DependencyObject. (Inherited from DependencyObject.) | .gif) | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | .gif) | Freeze()()() | Makes the current object unmodifiable and sets its IsFrozen property to true. (Inherited from Freezable.) | .gif) | FreezeCore | Makes this instance of ObjectAnimationUsingKeyFrames object is read-only or determines whether it can be made read-only. (Overrides Timeline..::.FreezeCore(Boolean).) | .gif) | GetAnimationBaseValue | Returns the non-animated value of the specified DependencyProperty. (Inherited from Animatable.) | .gif) | GetAsFrozen | Creates a frozen copy of the Freezable, using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.) | .gif) | GetAsFrozenCore | Makes this instance a clone of the specified ObjectAnimationUsingKeyFrames object. (Overrides Timeline..::.GetAsFrozenCore(Freezable).) | .gif) | GetCurrentValue | Gets the current value of the animation. (Inherited from ObjectAnimationBase.) | .gif) | GetCurrentValueAsFrozen | Creates a frozen copy of the Freezable using current property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.) | .gif) | GetCurrentValueAsFrozenCore | Makes this instance a frozen clone of the specified ObjectAnimationUsingKeyFrames. Resource references, data bindings, and animations are not copied, but their current values are. (Overrides Timeline..::.GetCurrentValueAsFrozenCore(Freezable).) | .gif) | GetCurrentValueCore | Calculates a value that represents the current value of the property being animated, as determined by this instance of ObjectAnimationUsingKeyFrames. (Overrides ObjectAnimationBase..::.GetCurrentValueCore(Object, Object, AnimationClock).) | .gif) | GetHashCode | Gets a hash code for this DependencyObject. (Inherited from DependencyObject.) | .gif) | GetLocalValueEnumerator | Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.) | .gif) | GetNaturalDuration | Returns the length of a single iteration of this Timeline. (Inherited from Timeline.) | .gif) | GetNaturalDurationCore | Provide a custom natural Duration when the Duration property is set to Automatic. (Overrides AnimationTimeline..::.GetNaturalDurationCore(Clock).) | .gif) | GetType | Gets the Type of the current instance. (Inherited from Object.) | .gif) | GetValue | Returns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.) | .gif) | InvalidateProperty | Re-evaluates the effective value for the specified dependency property (Inherited from DependencyObject.) | .gif) | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | .gif) | OnChanged | Called when the current ObjectAnimationUsingKeyFrames object is modified. (Overrides Freezable..::.OnChanged()()().) | .gif) | OnFreezablePropertyChanged(DependencyObject, DependencyObject) | Ensures that appropriate context pointers are established for a DependencyObjectType data member that has just been set. (Inherited from Freezable.) | .gif) | OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) | This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. (Inherited from Freezable.) | .gif) | OnPropertyChanged | Overrides the DependencyObject implementation of OnPropertyChanged to also invoke any Changed handlers in response to a changing dependency property of type Freezable. (Inherited from Freezable.) | .gif) | ReadLocalValue | Returns the local value of a dependency property, if it exists. (Inherited from DependencyObject.) | .gif) | ReadPreamble | Ensures that the Freezable is being accessed from a valid thread. Inheritors of Freezable must call this method at the beginning of any API that reads data members that are not dependency properties. (Inherited from Freezable.) | .gif) | SetCurrentValue | Sets the value of a dependency property without changing its value source. (Inherited from DependencyObject.) | .gif) | SetValue(DependencyProperty, Object) | Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.) | .gif) | SetValue(DependencyPropertyKey, Object) | Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.) | .gif) | ShouldSerializeKeyFrames | Returns true if the value of the KeyFrames property of this instance of ObjectAnimationUsingKeyFrames should be value-serialized. | .gif) | ShouldSerializeProperty | Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property. (Inherited from DependencyObject.) | .gif) | ToString | Returns a string that represents the current object. (Inherited from Object.) | .gif) | VerifyAccess | Enforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.) | .gif) | WritePostscript | Raises the Changed event for the Freezable and invokes its OnChanged method. Classes that derive from Freezable should call this method at the end of any API that modifies class members that are not stored as dependency properties. (Inherited from Freezable.) | .gif) | WritePreamble | Verifies that the Freezable is not frozen and that it is being accessed from a valid threading context. Freezable inheritors should call this method at the beginning of any API that writes to data members that are not dependency properties. (Inherited from Freezable.) | Top

Events

Explicit Interface Implementations

Remarks
A key frame animation's target values are defined by its KeyFrames property, which contains a collection of ObjectKeyFrame objects. Each ObjectKeyFrame defines a segment of the animation with its own target Value and KeyTime. When the animation runs, it progresses from one key value to the next at the specified key times. Animating the Key Frames of an ObjectAnimationUsingKeyFrames

Examples
This example shows how to animate an object, which in this example is the Background property of a Page control, by using key frames. The following example uses the ObjectAnimationUsingKeyFrames class to animate color changes for the Background property of a Page control. The example animation changes to a different background brush at regular intervals. This animation uses the DiscreteObjectKeyFrame class to create three different key frames. The animation uses key frames in the following manner: At the end of the first second, animates an instance of the LinearGradientBrush class. This section of the example applies a linear gradient to the background color so that the color transitions from yellow to orange to red. At the end of the next second, animates an instance of the RadialGradientBrush class. This section of the example applies a radial gradient to the background color so that the color transitions from white to blue to black. At the end of the third second, animates an instance of the DrawingBrush class. This section of the example applies a checkerboard pattern to the background. The animation begins again and repeats indefinitely.
Note |
|---|
DiscreteObjectKeyFrame is the only type of key frame that you can use with the ObjectAnimationUsingKeyFrames class. Key frames like DiscreteObjectKeyFrame create sudden changes in values, that is, the color changes in this example occur suddenly. |
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Page.Triggers>
<EventTrigger RoutedEvent="Page.Loaded">
<BeginStoryboard>
<Storyboard>
<!-- ObjectAnimationUsingKeyFrames is used to animate properties that take
an object as a value. This animation lasts for 4 seconds using 3 KeyFrames which
swap different brush objects at regular intervals, making the background of the Page
change. -->
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty="Background"
Duration="0:0:4" RepeatBehavior="Forever">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<!-- Note: Only discrete interpolation (DiscreteObjectKeyFrame) is available for
use with ObjectAnimationUsingKeyFrames which merely swaps objects according to
a specified timeline. Other types of interpolation are too problematic to apply
to objects. -->
<!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes
to a LinearGradientBrush after the first second of the animation. -->
<DiscreteObjectKeyFrame KeyTime="0:0:1">
<DiscreteObjectKeyFrame.Value>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes
to a RadialGradientBrush after the second second of the animation. -->
<DiscreteObjectKeyFrame KeyTime="0:0:2">
<DiscreteObjectKeyFrame.Value>
<RadialGradientBrush GradientOrigin="0.75,0.25">
<RadialGradientBrush.GradientStops>
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="MediumBlue" Offset="0.5" />
<GradientStop Color="Black" Offset="1.0" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly
changes to a DrawingBrush (creates a checkerboard pattern) after the
third second of the animation. -->
<DiscreteObjectKeyFrame KeyTime="0:0:3">
<DiscreteObjectKeyFrame.Value>
<DrawingBrush Viewport="0,0,0.25,0.25" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="White">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,1,1" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="Black"
Geometry="M 0,0 L0,0.5 0.5,0.5 0.5,1 1,1 1,0.5 0.5,0.5 0.5,0" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Page.Triggers>
</Page>
For the complete sample, see KeyFrame Animation Sample.

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also
|
Bibliothèque de classes .NET Framework ObjectAnimationUsingKeyFrames, classe

Hiérarchie d'héritage
Espace de noms :
System.Windows.Media.Animation
Assembly :
PresentationCore (dans PresentationCore.dll) XMLNS pour XAML : http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

Syntaxe
<ContentPropertyAttribute("KeyFrames")> _
Public Class ObjectAnimationUsingKeyFrames _
Inherits ObjectAnimationBase _
Implements IKeyFrameAnimation, IAddChild
[ContentPropertyAttribute("KeyFrames")]
public class ObjectAnimationUsingKeyFrames : ObjectAnimationBase,
IKeyFrameAnimation, IAddChild
[ContentPropertyAttribute(L"KeyFrames")]
public ref class ObjectAnimationUsingKeyFrames : public ObjectAnimationBase,
IKeyFrameAnimation, IAddChild
[<ContentPropertyAttribute("KeyFrames")>]
type ObjectAnimationUsingKeyFrames =
class
inherit ObjectAnimationBase
interface IKeyFrameAnimation
interface IAddChild
end
Utilisation des éléments objets XAML
<ObjectAnimationUsingKeyFrames>
KeyFrames
</ObjectAnimationUsingKeyFrames>
Le type ObjectAnimationUsingKeyFrames expose les membres suivants.

Constructeurs

Propriétés

Méthodes
|
| Nom | Description |
|---|
.gif) | AddChild | Ajoute un enfant ObjectKeyFrame à ce ObjectAnimationUsingKeyFrames. | .gif) | AddText | Ajoute une chaîne de texte en tant qu'enfant de ce ObjectAnimationUsingKeyFrames. | .gif) | AllocateClock | Crée un Clock pour ce AnimationTimeline. (Hérité de AnimationTimeline.) | .gif) | ApplyAnimationClock(DependencyProperty, AnimationClock) | Applique une horloge AnimationClock à la propriété DependencyProperty spécifiée. Si la propriété est déjà animée, le comportement de transfert SnapshotAndReplace est utilisé. (Hérité de Animatable.) | .gif) | ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) | Applique une horloge AnimationClock à la propriété DependencyProperty spécifiée. Si la propriété spécifiée est déjà animée, le comportement HandoffBehavior spécifié est utilisé. (Hérité de Animatable.) | .gif) | BeginAnimation(DependencyProperty, AnimationTimeline) | Applique une animation à la propriété DependencyPropertyspécifiée. L'animation est démarrée à la restitution de l'image suivante. Si la propriété spécifiée est déjà animée, le comportement de transfert SnapshotAndReplace est utilisé. (Hérité de Animatable.) | .gif) | BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior) | Applique une animation à la propriété DependencyPropertyspécifiée. L'animation est démarrée à la restitution de l'image suivante. Si la propriété spécifiée est déjà animée, le comportement HandoffBehavior spécifié est utilisé. (Hérité de Animatable.) | .gif) | CheckAccess | Détermine si le thread appelant a accès à ce DispatcherObject. (Hérité de DispatcherObject.) | .gif) | ClearValue(DependencyProperty) | Efface la valeur de proximité d'une propriété. La propriété à effacer est spécifiée par un identificateur DependencyProperty. (Hérité de DependencyObject.) | .gif) | ClearValue(DependencyPropertyKey) | Efface la valeur de proximité d'une propriété en lecture seule. La propriété à effacer est spécifiée par un DependencyPropertyKey. (Hérité de DependencyObject.) | .gif) | Clone | Crée un clone modifiable de ce ObjectAnimationUsingKeyFrames en copiant intégralement toutes ses valeurs. Lors de la copie de propriétés de dépendance, cette méthode copie les références de ressources et les liaisons de données (même si elles ne peuvent plus être résolues), mais pas les animations ni leurs valeurs actuelles. | .gif) | CloneCore | Convertit cette instance en copie complète du ObjectAnimationUsingKeyFrames spécifié. Lors de la copie de propriétés de dépendance, cette méthode copie les références des ressources et les liaisons aux données (même si elles ne peuvent plus être résolues), mais pas les animations et leurs valeurs actuelles. (Substitue Freezable..::.CloneCore(Freezable).) | .gif) | CloneCurrentValue | Crée un clone modifiable de cet objet ObjectAnimationUsingKeyFrames, en créant des copies complètes des valeurs actuelles de cet objet. Contrairement à leurs valeurs actuelles, les références de ressources, les liaisons de données et les animations ne sont pas copiées. | .gif) | CloneCurrentValueCore | Convertit cette instance en copie complète modifiable du ObjectAnimationUsingKeyFrames spécifié à l'aide des valeurs de propriétés actuelles. Contrairement à leurs valeurs actuelles, les références de ressources, les liaisons de données et les animations ne sont pas copiées. (Substitue Freezable..::.CloneCurrentValueCore(Freezable).) | .gif) | CoerceValue | Force la valeur de la propriété de dépendance spécifiée. Cette opération est accomplie en appelant toute fonction CoerceValueCallback spécifiée dans les métadonnées de propriété pour la propriété de dépendance comme elle existe sur le DependencyObject appelant. (Hérité de DependencyObject.) | .gif) | CreateClock()()() | Crée une nouvelle horloge AnimationClock à partir de la chronologie AnimationTimeline. (Hérité de AnimationTimeline.) | .gif) | CreateClock(Boolean) | Crée un Clock à partir de ce Timeline et spécifie si le nouveau Clock est contrôlable. Si ce Timeline a des enfants, une arborescence d'horloges est alors créée avec ce Timeline en tant que racine. (Hérité de Timeline.) | .gif) | CreateInstance | Initialise une nouvelle instance de la classe Freezable. (Hérité de Freezable.) | .gif) | CreateInstanceCore | Crée une nouvelle instance de ObjectAnimationUsingKeyFrames. (Substitue Freezable..::.CreateInstanceCore()()().) | .gif) | Equals | Détermine si un DependencyObject fourni est équivalent au DependencyObject réel. (Hérité de DependencyObject.) | .gif) | Finalize | Autorise un objet à tenter de libérer des ressources et d'exécuter d'autres opérations de netto***ge avant qu'il ne soit récupéré par l'opération garbage collection. (Hérité de Object.) | .gif) | Freeze()()() | Rend l'objet actuel non modifiable et définit sa propriété IsFrozen sur true. (Hérité de Freezable.) | .gif) | FreezeCore | Convertit cette instance d'objet ObjectAnimationUsingKeyFrames en instance accessible en lecture seule uniquement ou détermine si une telle conversion est possible. (Substitue Timeline..::.FreezeCore(Boolean).) | .gif) | GetAnimationBaseValue | Retourne la valeur non animée de la propriété DependencyProperty spécifiée. (Hérité de Animatable.) | .gif) | GetAsFrozen | Crée une copie figée de Freezable, à l'aide des valeurs de propriété (non-animées) de base. Étant donné que la copie est figée, tous les sous-objets figés sont copiés par référence. (Hérité de Freezable.) | .gif) | GetAsFrozenCore | Convertit cette instance en clone de l'objet spécifié ObjectAnimationUsingKeyFrames. (Substitue Timeline..::.GetAsFrozenCore(Freezable).) | .gif) | GetCurrentValue | Obtient la valeur actuelle de l'animation. (Hérité de ObjectAnimationBase.) | .gif) | GetCurrentValueAsFrozen | Crée une copie figée de Freezable à l'aide des valeurs de propriété actuelles. Étant donné que la copie est figée, tous les sous-objets figés sont copiés par référence. (Hérité de Freezable.) | .gif) | GetCurrentValueAsFrozenCore | Convertit cette instance en clone figé du ObjectAnimationUsingKeyFrames spécifié. Contrairement aux valeurs actuelles, les références de ressource, les liaisons de données et les animations ne sont pas copiées. (Substitue Timeline..::.GetCurrentValueAsFrozenCore(Freezable).) | .gif) | GetCurrentValueCore | Calcule une valeur qui représente la valeur actuelle de la propriété en cours d'animation, tel que déterminé par cette instance de ObjectAnimationUsingKeyFrames. (Substitue ObjectAnimationBase..::.GetCurrentValueCore(Object, Object, AnimationClock).) | .gif) | GetHashCode | Obtient un code de hachage pour ce DependencyObject. (Hérité de DependencyObject.) | .gif) | GetLocalValueEnumerator | Crée un énumérateur spécialisé pour déterminer quelles propriétés de dépendance ont des valeurs définies localement sur ce DependencyObject. (Hérité de DependencyObject.) | .gif) | GetNaturalDuration | Retourne la durée d'une seule itération de ce Timeline. (Hérité de Timeline.) | .gif) | GetNaturalDurationCore | Fournissez un Duration naturel personnalisé lorsque la propriété Duration a la valeur Automatic. (Substitue AnimationTimeline..::.GetNaturalDurationCore(Clock).) | .gif) | GetType | Obtient le Type de l'instance actuelle. (Hérité de Object.) | .gif) | GetValue | Retourne la valeur effective actuelle d'une propriété de dépendance sur cette instance d'un DependencyObject. (Hérité de DependencyObject.) | .gif) | InvalidateProperty | Réévalue la valeur effective pour la propriété de dépendance spécifiée (Hérité de DependencyObject.) | .gif) | MemberwiseClone | Crée une copie superficielle de l'objet Object actif. (Hérité de Object.) | .gif) | OnChanged | Appelé lorsque l'objet ObjectAnimationUsingKeyFrames actuel est modifié. (Substitue Freezable..::.OnChanged()()().) | .gif) | OnFreezablePropertyChanged(DependencyObject, DependencyObject) | Garantit que les pointeurs de contexte appropriés sont établis pour un membre de données de type DependencyObjectType qui vient juste d'être défini. (Hérité de Freezable.) | .gif) | OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) | Ce membre prend en charge l'infrastructure Windows Presentation Foundation (WPF) et n'est pas conçu pour être utilisé directement à partir du code. (Hérité de Freezable.) | .gif) | OnPropertyChanged | Substitue l'implémentation DependencyObject de OnPropertyChanged pour appeler également tous les gestionnaires Changed en réponse à une propriété de dépendance variable de type Freezable. (Hérité de Freezable.) | .gif) | ReadLocalValue | Retourne la valeur de proximité d'une propriété de dépendance, si elle existe. (Hérité de DependencyObject.) | .gif) | ReadPreamble | Garantit que Freezable est accessible à partir d'un thread valide. Les héritiers de Freezable doivent appeler cette méthode au début de toute API lisant les membres de données qui ne sont pas des propriétés de dépendance. (Hérité de Freezable.) | .gif) | SetCurrentValue | Définit la valeur d'une propriété de dépendance sans modifier sa source de valeur. (Hérité de DependencyObject.) | .gif) | SetValue(DependencyProperty, Object) | Définit la valeur de proximité d'une propriété de dépendance, spécifiée par son identificateur de propriété de dépendance. (Hérité de DependencyObject.) | .gif) | SetValue(DependencyPropertyKey, Object) | Définit la valeur de proximité d'une propriété de dépendance en lecture seule, spécifiée par l'identificateur DependencyPropertyKey de la propriété de dépendance. (Hérité de DependencyObject.) | .gif) | ShouldSerializeKeyFrames | Retourne la valeur true si la valeur de la propriété KeyFrames de cette instance de ObjectAnimationUsingKeyFrames doit être sérialisée par valeur. | .gif) | ShouldSerializeProperty | Retourne une valeur qui indique si les processus de sérialisation doivent sérialiser la valeur pour la propriété de dépendance fournie. (Hérité de DependencyObject.) | .gif) | ToString | Retourne une chaîne qui représente l'objet actuel. (Hérité de Object.) | .gif) | VerifyAccess | Garantit que le thread appelant a accès à DispatcherObject. (Hérité de DispatcherObject.) | .gif) | WritePostscript | Déclenche l'événement Changed pour Freezable et appelle sa méthode OnChanged. Les classes qui dérivent de Freezable doivent appeler cette méthode à la fin de toute API qui modifie des membres de classe non stockés en tant que propriétés de dépendance. (Hérité de Freezable.) | .gif) | WritePreamble | Vérifie que le Freezable n'est pas figé et que son accès s'effectue à partir d'un contexte de thread valide. Les héritiers de Freezable doivent appeler cette méthode au début de toute API écrivant les membres de données qui ne sont pas des propriétés de dépendance. (Hérité de Freezable.) | Début

Événements

Implémentations d'interface explicite

Notes
Les valeurs cibles de l'animation d'une image clé sont définies par sa propriété KeyFrames, laquelle contient une collection d'objets ObjectKeyFrame. Chaque ObjectKeyFrame définit un segment de l'animation avec ses propres Value et KeyTime cibles. Lors de l'exécution de l'animation, celle-ci passe d'une valeur de clé à la suivante en fonction des périodes de clé spécifiées. Animation des images clé d'un ObjectAnimationUsingKeyFrames

Exemples
This example shows how to animate an object, which in this example is the Background property of a Page control, by using key frames. The following example uses the ObjectAnimationUsingKeyFrames class to animate color changes for the Background property of a Page control. The example animation changes to a different background brush at regular intervals. This animation uses the DiscreteObjectKeyFrame class to create three different key frames. The animation uses key frames in the following manner: At the end of the first second, animates an instance of the LinearGradientBrush class. This section of the example applies a linear gradient to the background color so that the color transitions from yellow to orange to red. At the end of the next second, animates an instance of the RadialGradientBrush class. This section of the example applies a radial gradient to the background color so that the color transitions from white to blue to black. At the end of the third second, animates an instance of the DrawingBrush class. This section of the example applies a checkerboard pattern to the background. The animation begins again and repeats indefinitely.
Remarque |
|---|
DiscreteObjectKeyFrame is the only type of key frame that you can use with the ObjectAnimationUsingKeyFrames class. Key frames like DiscreteObjectKeyFrame create sudden changes in values, that is, the color changes in this example occur suddenly. |
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Page.Triggers>
<EventTrigger RoutedEvent="Page.Loaded">
<BeginStoryboard>
<Storyboard>
<!-- ObjectAnimationUsingKeyFrames is used to animate properties that take
an object as a value. This animation lasts for 4 seconds using 3 KeyFrames which
swap different brush objects at regular intervals, making the background of the Page
change. -->
<ObjectAnimationUsingKeyFrames
Storyboard.TargetProperty="Background"
Duration="0:0:4" RepeatBehavior="Forever">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<!-- Note: Only discrete interpolation (DiscreteObjectKeyFrame) is available for
use with ObjectAnimationUsingKeyFrames which merely swaps objects according to
a specified timeline. Other types of interpolation are too problematic to apply
to objects. -->
<!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes
to a LinearGradientBrush after the first second of the animation. -->
<DiscreteObjectKeyFrame KeyTime="0:0:1">
<DiscreteObjectKeyFrame.Value>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly changes
to a RadialGradientBrush after the second second of the animation. -->
<DiscreteObjectKeyFrame KeyTime="0:0:2">
<DiscreteObjectKeyFrame.Value>
<RadialGradientBrush GradientOrigin="0.75,0.25">
<RadialGradientBrush.GradientStops>
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="MediumBlue" Offset="0.5" />
<GradientStop Color="Black" Offset="1.0" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<!-- Using a DiscreteObjectKeyFrame, the Page Background suddenly
changes to a DrawingBrush (creates a checkerboard pattern) after the
third second of the animation. -->
<DiscreteObjectKeyFrame KeyTime="0:0:3">
<DiscreteObjectKeyFrame.Value>
<DrawingBrush Viewport="0,0,0.25,0.25" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="White">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,1,1" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="Black"
Geometry="M 0,0 L0,0.5 0.5,0.5 0.5,1 1,1 1,0.5 0.5,0.5 0.5,0" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Page.Triggers>
</Page>
For the complete sample, see KeyFrame Animation Sample.

Informations de version
.NET FrameworkPris en charge dans : 4, 3.5, 3.0 .NET Framework Client ProfilePris en charge dans : 4, 3.5 SP1

Plateformes
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Sécurité des threads
Tous les membres static ( Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Voir aussi
RéférenceAutres ressources
|