<p>I have something like this:</p>

<pre>
barProgress.BeginAnimation(RangeBase.ValueProperty, new DoubleAnimation(
    barProgress.Value, dNextProgressValue,
    new Duration(TimeSpan.FromSeconds(dDuration)));
</pre>

<p>Now, how would you stop that animation (the <code>DoubleAnimation</code>)? 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...</p>

[{'answer_id': 20306, 'author': 'TheSmurf', 'author_id': 1975282, 'author_profile': 'https://Stackoverflow.com/users/1975282', 'pm_score': 8, 'selected': True, 'text': '<p>To stop it, call <code>BeginAnimation</code> again with the second argument set to <code>null</code>.</p>\n'}, {'answer_id': 20560, 'author': 'Brian Leahy', 'author_id': 580, 'author_profile': 'https://Stackoverflow.com/users/580', 'pm_score': 2, 'selected': False, 'text': '<p>Place the animation in a StoryBoard.  Call Begin() and Stop() on the storyboard to start to stop the animations.</p>\n'}, {'answer_id': 36744, 'author': 'user3837', 'author_id': 3837, 'author_profile': 'https://Stackoverflow.com/users/3837', 'pm_score': 5, 'selected': False, 'text': '<p>When using storyboards to control an animation, make sure you set the second parameter to true in order to set the animation as controllable:</p>\n\n<pre><code>public void Begin(\n    FrameworkContentElement containingObject,\n    **bool isControllable**\n)\n</code></pre>\n'}, {'answer_id': 375105, 'author': 'Nick', 'author_id': 44741, 'author_profile': 'https://Stackoverflow.com/users/44741', 'pm_score': 3, 'selected': False, 'text': '<blockquote>\n  <p>If you want the base value to become\n  the effective value again, you must\n  stop the animation from influencing\n  the property. There are three ways to\n  do this with storyboard animations:</p>\n  \n  <ul>\n  <li>Set the animation\'s FillBehavior\n  property to Stop</li>\n  <li>Remove the entire Storyboard</li>\n  <li>Remove the animation from the\n  individual property</li>\n  </ul>\n</blockquote>\n\n<p>From MSDN</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/aa970493.aspx" rel="noreferrer">How to: Set a Property After Animating It with a Storyboard</a></p>\n'}, {'answer_id': 1071741, 'author': 'Junior Mayhé', 'author_id': 66708, 'author_profile': 'https://Stackoverflow.com/users/66708', 'pm_score': 3, 'selected': False, 'text': "<p>In my case I had to use two commands, my xaml has a button which fires a trigger, and its trigger fires the storyboard animation.</p>\n\n<p>I've put a button to stop animation with this code behind:</p>\n\n<pre><code>MyBeginStoryboard.Storyboard.Begin(this, true);\nMyBeginStoryboard.Storyboard.Stop(this);\n</code></pre>\n\n<p>I don't like it but it really works here. Give it a try!</p>\n"}, {'answer_id': 9436145, 'author': 'BruceLH', 'author_id': 1231415, 'author_profile': 'https://Stackoverflow.com/users/1231415', 'pm_score': 4, 'selected': False, 'text': '<p>There are two ways to stop a BeginAnimation.  The first is to call BeginAnimation again with the second parameter set to null.  This will remove all animations on the property and <strong>revert</strong> the value back to its base value.</p>\n\n<p>Depending on how you are using that value this may not be the behavior you want.  The second way is to set the animations BeginTime to null then call BeginAnimation with it.  This will remove that specific animation and leave the value at its current position.</p>\n\n<pre><code>DoubleAnimation myAnimation = new Animation();\n// Initialize animation\n...\n\n// To start\nelement.BeginAnimation(Property, myAnimation);\n\n// To stop and keep the current value of the animated property\nmyAnimation.BeginTime = null;\nelement.BeginAnimation(Property, myAnimation);\n</code></pre>\n'}, {'answer_id': 18101726, 'author': 'oliver', 'author_id': 1145234, 'author_profile': 'https://Stackoverflow.com/users/1145234', 'pm_score': 0, 'selected': False, 'text': '<p>You can use this code:</p>\n\n<pre><code>[StoryBoardName].Remove([StoryBoardOwnerControl]);\n</code></pre>\n'}, {'answer_id': 33472902, 'author': 'Fawaz', 'author_id': 4998659, 'author_profile': 'https://Stackoverflow.com/users/4998659', 'pm_score': 4, 'selected': False, 'text': '<pre><code>&lt;Trigger.EnterActions&gt;\n       &lt;BeginStoryboard x:Name="myStory"&gt;\n       .........\n       &lt;/BeginStoryboard&gt;\n&lt;/Trigger.EnterActions&gt;\n&lt;Trigger.ExitActions&gt;\n       &lt;StopStoryboard BeginStoryboardName="myStory"/&gt;\n&lt;/Trigger.ExitActions&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/20298', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2260/']