Animatable.ApplyAnimationClock Methode
Definition
Animiert die angegebene DependencyProperty mit der angegebenen AnimationClock.Animates the specified DependencyProperty using the specified AnimationClock.
Überlädt
ApplyAnimationClock(DependencyProperty, AnimationClock) |
Wendet einen AnimationClock auf die angegebene DependencyProperty an.Applies an AnimationClock to the specified DependencyProperty. Wenn die Eigenschaft bereits animiert wird, wird das SnapshotAndReplace-Übergabeverhalten verwendet.If the property is already animated, the SnapshotAndReplace handoff behavior is used. |
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) |
Wendet einen AnimationClock auf die angegebene DependencyProperty an.Applies an AnimationClock to the specified DependencyProperty. Wenn die Eigenschaft bereits animiert wird, wird das angegebene HandoffBehavior verwendet.If the property is already animated, the specified HandoffBehavior is used. |
ApplyAnimationClock(DependencyProperty, AnimationClock)
Wendet einen AnimationClock auf die angegebene DependencyProperty an.Applies an AnimationClock to the specified DependencyProperty. Wenn die Eigenschaft bereits animiert wird, wird das SnapshotAndReplace-Übergabeverhalten verwendet.If the property is already animated, the SnapshotAndReplace handoff behavior is used.
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
Die zu animierende Eigenschaft.The property to animate.
- clock
- AnimationClock
Der Takt, mit dem die angegebene Eigenschaft animiert werden soll.The clock with which to animate the specified property. Wenn clock
gleich null
ist, werden alle Animationen aus der angegebenen Eigenschaft entfernt (jedoch nicht angehalten).If clock
is null
, all animations will be removed from the specified property (but not stopped).
Implementiert
Hinweise
Beachten Sie, dass durch die Verwendung dieser Methode zum Entfernen von Uhren aus einer Eigenschaft diese Uhren nicht angehalten werden.Note that using this method to removing clocks from a property does not stop those clocks.
Gilt für:
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)
Wendet einen AnimationClock auf die angegebene DependencyProperty an.Applies an AnimationClock to the specified DependencyProperty. Wenn die Eigenschaft bereits animiert wird, wird das angegebene HandoffBehavior verwendet.If the property is already animated, the specified HandoffBehavior is used.
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
Die zu animierende Eigenschaft.The property to animate.
- clock
- AnimationClock
Der Takt, mit dem die angegebene Eigenschaft animiert werden soll.The clock with which to animate the specified property. Wenn handoffBehavior
den Wert SnapshotAndReplace aufweist und clock
null
ist, werden alle Animationen aus der angegebenen Eigenschaft entfernt (jedoch nicht angehalten).If handoffBehavior
is SnapshotAndReplace and clock
is null
, all animations will be removed from the specified property (but not stopped). Wenn für handoffBehavior
der Wert Compose festgelegt ist und clock null
ist, hat diese Methode keine Auswirkungen.If handoffBehavior
is Compose and clock is null
, this method has no effect.
- handoffBehavior
- HandoffBehavior
Ein Wert, der angibt, wie die neue Animation ggf. mit aktuellen Animationen interagieren soll, die sich bereits auf den Eigenschaftswert auswirken.A value that specifies how the new animation should interact with any current animations already affecting the property value.
Implementiert
Beispiele
Im folgenden Beispiel wird gezeigt, wie Sie Animations Uhren mit unterschiedlichen HandoffBehavior Einstellungen anwenden.The following example shows how to apply animation clocks using different HandoffBehavior settings.
Hinweise
Beachten Sie, dass durch die Verwendung dieser Methode zum Entfernen von Uhren aus einer Eigenschaft diese Uhren nicht angehalten werden.Note that using this method to remove clocks from a property does not stop those clocks.
Verwenden von Compose HandoffBehaviorUsing the Compose HandoffBehavior
Wenn Sie Storyboard , AnimationTimeline oder AnimationClock auf eine Eigenschaft mithilfe von anwenden Compose HandoffBehavior , Clock verbrauchen alle Objekte, die dieser Eigenschaft zuvor zugeordnet sind, weiterhin Systemressourcen. das Zeit Steuerungssystem entfernt diese Uhren nicht automatisch.When you apply a Storyboard, AnimationTimeline, or AnimationClock to a property using the Compose HandoffBehavior, any Clock objects previously associated with that property continue to consume system resources; the timing system will not remove these clocks automatically.
Um Leistungsprobleme zu vermeiden, wenn Sie eine große Anzahl von Uhren mithilfe von anwenden Compose , sollten Sie das Verfassen von Uhren aus der animierten Eigenschaft entfernen, nachdem Sie fertiggestellt wurden.To avoid performance issues when you apply a large number of clocks using Compose, you should remove composing clocks from the animated property after they complete. Es gibt mehrere Möglichkeiten, eine Uhr zu entfernen.There are several ways to remove a clock.
Um alle Uhren aus einer Eigenschaft zu entfernen, verwenden Sie die- ApplyAnimationClock(DependencyProperty, AnimationClock) BeginAnimation(DependencyProperty, AnimationTimeline) Methode oder die-Methode des animierten Objekts.To remove all clocks from a property, use the ApplyAnimationClock(DependencyProperty, AnimationClock) or BeginAnimation(DependencyProperty, AnimationTimeline) method of the animated object. Geben Sie die zu animierende Eigenschaft als ersten Parameter und
null
als Sekunde an.Specify the property being animated as the first parameter, andnull
as the second. Dies entfernt alle Animationsuhren aus der Eigenschaft.This will remove all animation clocks from the property.Um einen bestimmten AnimationClock aus einer Liste von Uhren zu entfernen, verwenden Controller Sie die-Eigenschaft des, AnimationClock um eine abzurufen ClockController , und rufen Sie dann die- Remove Methode von auf ClockController .To remove a specific AnimationClock from a list of clocks, use the Controller property of the AnimationClock to retrieve a ClockController, then call the Remove method of the ClockController. Dies erfolgt in der Regel im Completed Ereignishandler für eine Uhr.This is typically done in the Completed event handler for a clock. Beachten Sie, dass nur Stamm Uhren von einem gesteuert werden können ClockController ; die- Controller Eigenschaft einer untergeordneten Uhr gibt zurück
null
.Note that only root clocks can be controlled by a ClockController; the Controller property of a child clock will returnnull
. Beachten Sie auch, dass das Completed Ereignis nicht aufgerufen wird, wenn die effektive Dauer der Uhr ewig ist.Note also that the Completed event will not be called if the effective duration of the clock is forever. In diesem Fall muss der Benutzer bestimmen, wann er aufgerufen werden soll Remove .In that case, the user will need to determine when to call Remove.
Dies betrifft hauptsächlich Animationen für Objekte, die eine lange Lebensdauer haben.This is primarily an issue for animations on objects that have a long lifetime. Wenn ein Objekt an den Garbage Collector übergeben wird, werden auch die Uhren getrennt und an den Garbage Collector übergeben.When an object is garbage collected, its clocks will also be disconnected and garbage collected.
Weitere Informationen zu Clock-Objekten finden Sie unter Übersicht über das Animations-und Zeit Steuerungssystem.For more information about clock objects, see the Animation and Timing System Overview.