Animatable.ApplyAnimationClock Método
Definição
Desenha o DependencyProperty especificado usando o AnimationClock especificado.Animates the specified DependencyProperty using the specified AnimationClock.
Sobrecargas
ApplyAnimationClock(DependencyProperty, AnimationClock) |
Aplica um AnimationClock ao DependencyProperty especificado.Applies an AnimationClock to the specified DependencyProperty. Se a propriedade já tiver sido animada, o comportamento de entrega de SnapshotAndReplace será usado.If the property is already animated, the SnapshotAndReplace handoff behavior is used. |
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) |
Aplica um AnimationClock ao DependencyProperty especificado.Applies an AnimationClock to the specified DependencyProperty. Se a propriedade já for animada, o HandoffBehavior especificado será usado.If the property is already animated, the specified HandoffBehavior is used. |
ApplyAnimationClock(DependencyProperty, AnimationClock)
Aplica um AnimationClock ao DependencyProperty especificado.Applies an AnimationClock to the specified DependencyProperty. Se a propriedade já tiver sido animada, o comportamento de entrega de SnapshotAndReplace será usado.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)
Parâmetros
A propriedade a ser animada.The property to animate.
- clock
- AnimationClock
O relógio com o qual animar a propriedade especificada.The clock with which to animate the specified property. Se clock
for null
, todas as animações serão removidas da propriedade especificada (mas não paradas).If clock
is null
, all animations will be removed from the specified property (but not stopped).
Implementações
Comentários
Observe que o uso desse método para remover relógios de uma propriedade não interrompe esses relógios.Note that using this method to removing clocks from a property does not stop those clocks.
Aplica-se a
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)
Aplica um AnimationClock ao DependencyProperty especificado.Applies an AnimationClock to the specified DependencyProperty. Se a propriedade já for animada, o HandoffBehavior especificado será usado.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)
Parâmetros
A propriedade a ser animada.The property to animate.
- clock
- AnimationClock
O relógio com o qual animar a propriedade especificada.The clock with which to animate the specified property. Se handoffBehavior
for SnapshotAndReplace e clock
for null
, todas as animações serão removidas da propriedade especificada (mas não paradas).If handoffBehavior
is SnapshotAndReplace and clock
is null
, all animations will be removed from the specified property (but not stopped). Se handoffBehavior
for Compose e o relógio for null
, esse método não terá nenhum efeito.If handoffBehavior
is Compose and clock is null
, this method has no effect.
- handoffBehavior
- HandoffBehavior
Um valor que especifica como a nova animação deve interagir com qualquer animação atual que já afete o valor da propriedade.A value that specifies how the new animation should interact with any current animations already affecting the property value.
Implementações
Exemplos
O exemplo a seguir mostra como aplicar relógios de animação usando HandoffBehavior configurações diferentes.The following example shows how to apply animation clocks using different HandoffBehavior settings.
Comentários
Observe que o uso desse método para remover relógios de uma propriedade não interrompe esses relógios.Note that using this method to remove clocks from a property does not stop those clocks.
Usando o HandoffBehavior de composiçãoUsing the Compose HandoffBehavior
Quando você aplica um Storyboard , AnimationTimeline ou AnimationClock a uma propriedade usando o Compose HandoffBehavior , todos os Clock objetos associados anteriormente a essa propriedade continuam a consumir recursos do sistema; o sistema de tempo não removerá esses relógios automaticamente.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.
Para evitar problemas de desempenho ao aplicar um grande número de relógios usando Compose o, você deve remover os relógios de composição da propriedade animada depois que eles forem concluídos.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. Há várias maneiras para remover um relógio.There are several ways to remove a clock.
Para remover todos os relógios de uma propriedade, use o ApplyAnimationClock(DependencyProperty, AnimationClock) BeginAnimation(DependencyProperty, AnimationTimeline) método ou do objeto animado.To remove all clocks from a property, use the ApplyAnimationClock(DependencyProperty, AnimationClock) or BeginAnimation(DependencyProperty, AnimationTimeline) method of the animated object. Especifique a propriedade que está sendo animada como o primeiro parâmetro e
null
o segundo.Specify the property being animated as the first parameter, andnull
as the second. Isso removerá todos os relógios de animação da propriedade.This will remove all animation clocks from the property.Para remover um específico AnimationClock de uma lista de relógios, use a Controller Propriedade do AnimationClock para recuperar um ClockController e, em seguida, chame o Remove método do 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. Normalmente, isso é feito no Completed manipulador de eventos para um relógio.This is typically done in the Completed event handler for a clock. Observe que somente os relógios raiz podem ser controlados por a ClockController ; a Controller propriedade de um relógio filho retornará
null
.Note that only root clocks can be controlled by a ClockController; the Controller property of a child clock will returnnull
. Observe também que o Completed evento não será chamado se a duração efetiva do relógio for para sempre.Note also that the Completed event will not be called if the effective duration of the clock is forever. Nesse caso, o usuário precisará determinar quando chamar Remove .In that case, the user will need to determine when to call Remove.
Isso é basicamente um problema para animações em objetos que têm um longo tempo de vida.This is primarily an issue for animations on objects that have a long lifetime. Quando um objeto passa pela coleta de lixo, seus relógios também serão desconectados e coletados como lixo.When an object is garbage collected, its clocks will also be disconnected and garbage collected.
Para obter mais informações sobre objetos de relógio, consulte a visão geral da animação e do sistema de tempo.For more information about clock objects, see the Animation and Timing System Overview.