Animations can be applied without using the StoryBoard. BeginAnimation() method can be used to apply animations instead of StoryBoard. This method can be used when simple animations are applied to a property of a control.
The following code snippet animates the width of the TextBlock using the ’BeginAnimation’ method.
[C#]
DoubleAnimation Dblanimation = new DoubleAnimation();
Dblanimation.From = 25;
Dblanimation.To = 50;
Dblanimation.Duration = new Duration(TimeSpan.FromSeconds(3));
tb.BeginAnimation(TextBlock.WidthProperty, Dblanimation);
Share with