Teilen über


UIElement.ApplyAnimationClock Methode

Definition

Wendet eine Animation auf eine angegebene Abhängigkeitseigenschaft für dieses Element an.

Überlädt

ApplyAnimationClock(DependencyProperty, AnimationClock)

Wendet eine Animation auf eine angegebene Abhängigkeitseigenschaft für dieses Element an. Alle vorhandenen Animationen werden angehalten und durch die neue Animation ersetzt.

ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)

Wendet eine Animation auf eine angegebene Abhängigkeitseigenschaft für dieses Element an, mit der Möglichkeit anzugeben, was passiert, wenn die Eigenschaft bereits über eine ausgeführte Animation verfügt.

Hinweise

Diese Methode ist versiegelt und kann nicht außer Kraft gesetzt werden.

ApplyAnimationClock(DependencyProperty, AnimationClock)

Wendet eine Animation auf eine angegebene Abhängigkeitseigenschaft für dieses Element an. Alle vorhandenen Animationen werden angehalten und durch die neue Animation ersetzt.

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)

Parameter

dp
DependencyProperty

Der Bezeichner für die zu animierende Eigenschaft.

clock
AnimationClock

Die Animationsuhr, die die Animation steuert und deklariert.

Implementiert

Beispiele

Im folgenden Beispiel weist ein RectanglemyAnimatedRectangle eine bestimmte Timinganimation auf, indem ApplyAnimationClock aufgerufen wird.

// 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)

Hinweise

Um eine Animation aus einer Eigenschaft zu entfernen, geben Sie den Bezeichner für diese Eigenschaft als dp an, und geben Sie clock als nullan. Dadurch wird die Animation entfernt, und die animierte Eigenschaft wird auf den Basiswert festgelegt. Die ursprünglich zugeordnete Animationsuhr wird jedoch nicht beendet. Alle anderen Animationen, die dieser Uhr zugewiesen sind, werden weiterhin ausgeführt.

Gilt für:

ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)

Wendet eine Animation auf eine angegebene Abhängigkeitseigenschaft für dieses Element an, mit der Möglichkeit anzugeben, was passiert, wenn die Eigenschaft bereits über eine ausgeführte Animation verfügt.

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)

Parameter

dp
DependencyProperty

Die zu animierende Eigenschaft.

clock
AnimationClock

Die Animationsuhr, die die Animation steuert und deklariert.

handoffBehavior
HandoffBehavior

Ein Wert der Aufzählung. Der Standardwert ist SnapshotAndReplace, wodurch alle vorhandenen Animationen beendet und durch die neue ersetzt werden.

Implementiert

Hinweise

Um eine Animation aus einer Eigenschaft zu entfernen, geben Sie den Bezeichner für diese Eigenschaft als dp an, und geben Sie clock als nullan. Dadurch wird die Animation entfernt, und die animierte Eigenschaft wird auf den Basiswert festgelegt. Die ursprünglich zugeordnete Animationsuhr wird jedoch nicht beendet. Alle anderen Animationen, die dieser Uhr zugewiesen sind, werden weiterhin ausgeführt.

Gilt für: