UIElement.ApplyAnimationClock Méthode

Définition

Applique une animation à une propriété de dépendance spécifiée sur cet élément.

Surcharges

ApplyAnimationClock(DependencyProperty, AnimationClock)

Applique une animation à une propriété de dépendance spécifiée sur cet élément. Les animations existantes sont arrêtées et remplacées par la nouvelle animation.

ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)

Applique une animation à une propriété de dépendance spécifiée sur cet élément, avec la possibilité de spécifier ce qui se produit si la propriété a déjà une animation en cours d’exécution.

Remarques

Cette méthode est sealed et ne peut pas être substituée.

ApplyAnimationClock(DependencyProperty, AnimationClock)

Applique une animation à une propriété de dépendance spécifiée sur cet élément. Les animations existantes sont arrêtées et remplacées par la nouvelle animation.

public:
 virtual void ApplyAnimationClock(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationClock ^ clock);
public void ApplyAnimationClock (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationClock clock);
abstract member ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock -> unit
override this.ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock -> unit
Public Sub ApplyAnimationClock (dp As DependencyProperty, clock As AnimationClock)

Paramètres

dp
DependencyProperty

Identificateur de la propriété à animer.

clock
AnimationClock

Horloge d’animation qui contrôle et déclare l’animation.

Implémente

Exemples

Dans l’exemple suivant, une Rectangle myAnimatedRectangle animation de minutage particulière est appliquée à celle-ci en appelant ApplyAnimationClock .

// Create a DoubleAnimation to
// animate its width.
DoubleAnimation widthAnimation = 
    new DoubleAnimation(
        100,
        500, 
        new Duration(TimeSpan.FromSeconds(5)));
//widthAnimation.RepeatBehavior = RepeatBehavior.Forever;
widthAnimation.AutoReverse = true;
widthAnimation.SpeedRatio = 0.5;
        
// Create a clock from the animation.
myControllableClock = widthAnimation.CreateClock();

// Apply the clock to the rectangle's Width property.
animatedRectangle.ApplyAnimationClock(
    Rectangle.WidthProperty, myControllableClock);
' Create a DoubleAnimation to
' animate its width.
'widthAnimation.RepeatBehavior = RepeatBehavior.Forever
Dim widthAnimation As New DoubleAnimation(100, 500, New Duration(TimeSpan.FromSeconds(5))) With {
    .AutoReverse = True,
    .SpeedRatio = 0.5
}

    ' Create a clock from the animation.
myControllableClock = widthAnimation.CreateClock()

' Apply the clock to the rectangle's Width property.
animatedRectangle.ApplyAnimationClock(Rectangle.WidthProperty, myControllableClock)

Remarques

Pour supprimer une animation d’une propriété, spécifiez l’identificateur de cette propriété comme dp et le spécifiez clock comme null. Cela supprime l’animation et la propriété animée est définie sur sa valeur de base. Toutefois, l’horloge d’animation associée à l’origine n’est pas arrêtée. Toutes les autres animations affectées à cette horloge continuent à s’exécuter.

S’applique à

ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)

Applique une animation à une propriété de dépendance spécifiée sur cet élément, avec la possibilité de spécifier ce qui se produit si la propriété a déjà une animation en cours d’exécution.

public:
 virtual void ApplyAnimationClock(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationClock ^ clock, System::Windows::Media::Animation::HandoffBehavior handoffBehavior);
public void ApplyAnimationClock (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationClock clock, System.Windows.Media.Animation.HandoffBehavior handoffBehavior);
abstract member ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock * System.Windows.Media.Animation.HandoffBehavior -> unit
override this.ApplyAnimationClock : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationClock * System.Windows.Media.Animation.HandoffBehavior -> unit
Public Sub ApplyAnimationClock (dp As DependencyProperty, clock As AnimationClock, handoffBehavior As HandoffBehavior)

Paramètres

dp
DependencyProperty

Propriété à animer.

clock
AnimationClock

Horloge d’animation qui contrôle et déclare l’animation.

handoffBehavior
HandoffBehavior

Valeur de l’énumération. La valeur par défaut est SnapshotAndReplace, ce qui arrête toute animation existante et la remplace par la nouvelle.

Implémente

Remarques

Pour supprimer une animation d’une propriété, spécifiez l’identificateur de cette propriété comme dp et le spécifiez clock comme null. Cela supprime l’animation et la propriété animée est définie sur sa valeur de base. Toutefois, l’horloge d’animation associée à l’origine n’est pas arrêtée. Toutes les autres animations affectées à cette horloge continuent à s’exécuter.

S’applique à