title: How to stop Storyboard in WPF?
body: <p>I have an animation.<br>
  But I can't stop it.<br>
  Because storyboard repeat behavior property is "Forever".<br>
  How can I stop the animation from code behind?</p>
  
  <p>Here is my XAML:</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
      &lt;Storyboard x:Name="loadingAnimation" x:Key="LoadingAnimation" RepeatBehavior="Forever" SpeedRatio="1" AutoReverse="True"&gt;
          &lt;DoubleAnimationUsingKeyFrames x:Name="doubleAnimationUsingKeyFrames" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="pathListBox"&gt;
              &lt;EasingDoubleKeyFrame KeyTime="0" Value="0"/&gt;
              &lt;EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/&gt;
          &lt;/DoubleAnimationUsingKeyFrames&gt;
          &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="ellipse"&gt;
              &lt;EasingDoubleKeyFrame KeyTime="0:0:1" Value="293.73"&gt;
                  &lt;EasingDoubleKeyFrame.EasingFunction&gt;
                      &lt;BackEase EasingMode="EaseOut"/&gt;
                  &lt;/EasingDoubleKeyFrame.EasingFunction&gt;
              &lt;/EasingDoubleKeyFrame&gt;
              &lt;EasingDoubleKeyFrame KeyTime="0:0:2" Value="560.097"/&gt;
          &lt;/DoubleAnimationUsingKeyFrames&gt;
      &lt;/Storyboard&gt;
  &lt;/UserControl.Resources&gt;
  </code></pre>