Cette documentation est archivée et n’est pas conservée.

UIElement.BeginAnimation, méthode (DependencyProperty, AnimationTimeline)

Starts an animation for a specified animated property on this element.

Espace de noms: System.Windows
Assembly : PresentationCore (dans presentationcore.dll)

public void BeginAnimation (
	DependencyProperty dp,
	AnimationTimeline animation
public final void BeginAnimation (
	DependencyProperty dp, 
	AnimationTimeline animation
public final function BeginAnimation (
	dp : DependencyProperty, 
	animation : AnimationTimeline
Vous ne pouvez pas utiliser des méthodes dans XAML.



The property to animate, which is specified as a dependency property identifier.


The timeline of the animation to start.

When you check whether a property is animated, note that the animation will begin and be considered animated when the first frame beyond the non-animated starting point is rendered.

If the BeginTime for animation is référence Null (Nothing en Visual Basic), then any current animations are removed and the current value of the property is held.

If the entire animation value is référence Null (Nothing en Visual Basic), all animations are removed from the property and the property value reverts to its base value. However, the originally associated animation timeline is not stopped. Any other animations assigned to that timeline will continue to run.

The following example creates an animation, assigns it, and then calls BeginAnimation to start it.

// Animate the button's width.
DoubleAnimation widthAnimation = 
    new DoubleAnimation(120, 300, TimeSpan.FromSeconds(5));
widthAnimation.RepeatBehavior = RepeatBehavior.Forever;
widthAnimation.AutoReverse = true;
animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation);

Microsoft .NET Framework 3.0 est pris en charge sur Windows Vista, Microsoft Windows XP SP2 et Windows Server 2003 SP1.

.NET Framework

Prise en charge dans : 3.0