Animatable.BeginAnimation Method (DependencyProperty, AnimationTimeline)
Assembly: PresentationCore (in PresentationCore.dll)
abstract BeginAnimation : dp:DependencyProperty * animation:AnimationTimeline -> unit override BeginAnimation : dp:DependencyProperty * animation:AnimationTimeline -> unit
- Type: System.Windows.DependencyProperty
The property to animate.
- Type: System.Windows.Media.Animation.AnimationTimeline
The animation used to animate the specified property.
If the animation's BeginTime is a null reference (Nothing in Visual Basic), any current animations will be removed and the current value of the property will be held.
If animation is a null reference (Nothing in Visual Basic), all animations will be removed from the property and the property value will revert back to its base value.
If the animation has a BeginTime that is greater than zero, the animation begins after that amount of time has elapsed from the time the next frame is rendered.
This example shows one way to apply an animation to a property without using a Storyboard.
This functionality is not available in Extensible Application Markup Language (XAML). For information about animating a property in XAML, see How to: Animate a Property by Using a Storyboard.
To apply a local animation to a property, use the BeginAnimation method. This method takes two parameters: a DependencyProperty that specifies the property to animate, and the animation to apply to that property.
The following example shows how to animate the width and background color of a Button.
A variety of animation classes in the System.Windows.Media.Animation namespace exist for animating different types of properties. For more information about animating properties, see Animation Overview. For more information about dependency properties (the type of properties that are shown in these examples) and their features, see Dependency Properties Overview.