title: How can I stop a custom storyboard with a data trigger?
body: <p>I have a storyboard for a canvas and I want to stop it as soon as the <strong>ShowError</strong> property has changed.</p>
  <pre><code> &lt;UserControl.Resources&gt;
          &lt;Storyboard x:Key=&quot;LoaderAnimation&quot; Name=&quot;LoaderAnimation&quot; &gt;
              &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=&quot;(UIElement.RenderTransform).(RotateTransform.Angle)&quot; 
                                             Storyboard.TargetName=&quot;canvas&quot; 
                                             RepeatBehavior=&quot;Forever&quot;&gt;
                  &lt;EasingDoubleKeyFrame KeyTime=&quot;0&quot; Value=&quot;0&quot;/&gt;
                  &lt;EasingDoubleKeyFrame KeyTime=&quot;0:0:3&quot; Value=&quot;360&quot;/&gt;
              &lt;/DoubleAnimationUsingKeyFrames&gt;
          &lt;/Storyboard&gt;
      &lt;/UserControl.Resources&gt;
  
  
          &lt;Viewbox x:Name=&quot;LayoutRoot&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Top&quot; Grid.Row=&quot;0&quot; Height=&quot;150&quot; Width=&quot;250&quot;&gt;
              &lt;Canvas Height=&quot;323&quot; Width=&quot;308&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; x:Name=&quot;canvas&quot;&gt;
                  &lt;Canvas.RenderTransform&gt;
                      &lt;RotateTransform/&gt;
                  &lt;/Canvas.RenderTransform&gt;
  
                  &lt;Ellipse Fill=&quot;{Binding Foreground, ElementName=userControl}&quot; Height=&quot;71&quot; Canvas.Left=&quot;121&quot; Canvas.Top=&quot;21&quot; Width=&quot;69&quot; Opacity=&quot;0.3&quot;/&gt;
                  &lt;Ellipse Fill=&quot;{Binding Foreground, ElementName=userControl}&quot; Height=&quot;71&quot; Width=&quot;69&quot; Canvas.Left=&quot;194&quot; Canvas.Top=&quot;52&quot; Opacity=&quot;0.4&quot;/&gt;
                  &lt;Ellipse Fill=&quot;{Binding Foreground, ElementName=userControl}&quot; Width=&quot;69&quot; Height=&quot;71&quot; 
  
              &lt;/Canvas&gt;
          &lt;/Viewbox&gt;
  
          &lt;TextBlock Grid.Row=&quot;1&quot; TextWrapping=&quot;Wrap&quot; FontSize=&quot;20&quot; Margin=&quot;0 20 0 0&quot;&gt;
              &lt;TextBlock.Style&gt;
                  &lt;Style TargetType=&quot;TextBlock&quot;&gt;
                      &lt;Style.Triggers&gt;
                          &lt;DataTrigger Binding=&quot;{Binding ShowError}&quot; Value=&quot;false&quot;&gt;
                              &lt;Setter Property=&quot;Text&quot; Value=&quot;{loc:Translate LogIn.TestSpsConnection}&quot; /&gt;
                              &lt;Setter Property=&quot;Foreground&quot; Value=&quot;Black&quot; /&gt;
                          &lt;/DataTrigger&gt;
                          &lt;DataTrigger Binding=&quot;{Binding ShowError}&quot; Value=&quot;true&quot;&gt;
                              &lt;Setter Property=&quot;Text&quot; Value=&quot;{loc:Translate LogIn.FailSpsConnection}&quot; /&gt;
                              &lt;Setter Property=&quot;Foreground&quot; Value=&quot;Red&quot; /&gt;
                          &lt;/DataTrigger&gt;
                      &lt;/Style.Triggers&gt;
                  &lt;/Style&gt;
              &lt;/TextBlock.Style&gt;
          &lt;/TextBlock&gt;
          
      &lt;/Grid&gt;
  </code></pre>
  <p>I've tried every idea but I can't access the storyboard from the style of the TextBlock.
  Is there any way I can stop the animation when <strong>ShowError</strong> goes true ?
  thank you for your help</p>