This documentation is archived and is not being maintained.

UIElement::BeginAnimation Method (DependencyProperty, AnimationTimeline, HandoffBehavior)

Starts a specific animation for a specified animated property on this element, with the option of specifying what happens if the property already has a running animation.

Namespace:  System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

virtual void BeginAnimation(
	DependencyProperty^ dp, 
	AnimationTimeline^ animation, 
	HandoffBehavior handoffBehavior
) sealed
You cannot use methods in XAML.


Type: System.Windows::DependencyProperty

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

Type: System.Windows.Media.Animation::AnimationTimeline

The timeline of the animation to be applied.

Type: System.Windows.Media.Animation::HandoffBehavior

A value of the enumeration that specifies how the new animation interacts with any current (running) animations that are already affecting the property value.


IAnimatable::BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

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 nullptr, then any current animations are removed and the current value of the property is held.

If the entire animation value is nullptr, 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 implements a handler that obtains an existing animation from a resource and then calls BeginAnimation with a specified handoff behavior.

private void myFrameNavigated(object sender, NavigationEventArgs args)
    DoubleAnimation myFadeInAnimation = (DoubleAnimation)this.Resources["MyFadeInAnimationResource"];
    myFrame.BeginAnimation(Frame.OpacityProperty, myFadeInAnimation, HandoffBehavior.SnapshotAndReplace);

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0