How to stop an animation in C# / WPF?

c#, wpf

Solution

To stop it, call `BeginAnimation` again with the second argument set to `null`.

Problem

I have something like this: ``` barProgress.BeginAnimation(RangeBase.ValueProperty, new DoubleAnimation( barProgress.Value, dNextProgressValue, new Duration(TimeSpan.FromSeconds(dDuration))); ``` Now, how would you stop that animation (the `DoubleAnimation`)? The reason I want to do this, is because I would like to start new animations (this seems to work, but it's hard to tell) and eventually stop the last animation...

Original source