UIElement.ApplyAnimationClock Método
Definición
Aplica una animación a una propiedad de dependencia especificada en este elemento.Applies an animation to a specified dependency property on this element.
Sobrecargas
ApplyAnimationClock(DependencyProperty, AnimationClock) |
Aplica una animación a una propiedad de dependencia especificada en este elemento.Applies an animation to a specified dependency property on this element. Se detiene cualquier animación existente y se reemplaza con la nueva animación.Any existing animations are stopped and replaced with the new animation. |
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior) |
Aplica una animación a una propiedad de dependencia especificada en este elemento, con capacidad para especificar lo que ocurre si la propiedad ya tiene una animación en ejecución.Applies an animation to a specified dependency property on this element, with the ability to specify what happens if the property already has a running animation. |
Comentarios
Este método está sellado y no se puede invalidar.This method is sealed and cannot be overridden.
ApplyAnimationClock(DependencyProperty, AnimationClock)
Aplica una animación a una propiedad de dependencia especificada en este elemento.Applies an animation to a specified dependency property on this element. Se detiene cualquier animación existente y se reemplaza con la nueva animación.Any existing animations are stopped and replaced with the new 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)
Parámetros
Identificador de la propiedad que se animará.The identifier for the property to animate.
- clock
- AnimationClock
Reloj de animación que controla y declara la animación.The animation clock that controls and declares the animation.
Implementaciones
Ejemplos
En el ejemplo siguiente, Rectangle myAnimatedRectangle
se le aplica una animación de temporización determinada mediante una llamada a ApplyAnimationClock .In the following example, a Rectangle myAnimatedRectangle
has a particular timing animation applied to it by calling 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)
Comentarios
Para quitar una animación de una propiedad, especifique el identificador de esa propiedad como dp
y especifique clock
como null
.To remove an animation from a property, specify the identifier for that property as dp
and specify clock
as null
. Esto quita la animación y la propiedad animada se establece en su valor base.This removes the animation and the animated property is set to its base value. Sin embargo, el reloj de animación asociado originalmente no se detiene.However, the originally associated animation clock is not stopped. Cualquier otra animación asignada a ese reloj continuará ejecutándose.Any other animations assigned to that clock will continue to run.
Se aplica a
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)
Aplica una animación a una propiedad de dependencia especificada en este elemento, con capacidad para especificar lo que ocurre si la propiedad ya tiene una animación en ejecución.Applies an animation to a specified dependency property on this element, with the ability to specify what happens if the property already has a running animation.
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
Propiedad que se va a animar.The property to animate.
- clock
- AnimationClock
Reloj de animación que controla y declara la animación.The animation clock that controls and declares the animation.
- handoffBehavior
- HandoffBehavior
Valor de la enumeración.A value of the enumeration. El valor predeterminado es SnapshotAndReplace, que detendrá cualquier animación existente y la reemplazará por una nueva.The default is SnapshotAndReplace, which will stop any existing animation and replace with the new one.
Implementaciones
Comentarios
Para quitar una animación de una propiedad, especifique el identificador de esa propiedad como dp
y especifique clock
como null
.To remove an animation from a property, specify the identifier for that property as dp
and specify clock
as null
. Esto quita la animación y la propiedad animada se establece en su valor base.This removes the animation and the animated property is set to its base value. Sin embargo, el reloj de animación asociado originalmente no se detiene.However, the originally associated animation clock is not stopped. Cualquier otra animación asignada a ese reloj continuará ejecutándose.Any other animations assigned to that clock will continue to run.