title: WPF/Silverlight: How to DataTrigger a Storyboard Animation in MVVM?
body: <p>I have a boolean property called IsLoginWrong, I want to then play a storyboard animation if the IsLoginWrong is true. (IsLoginWrong does an OnPropertyChanged event, so I know the binding is ok) But I'm having a hard time with the syntax. This might not even be right, but I think datatriggers can only live in Styles...</p>
  
  <pre><code>&lt;UserControl.Style&gt;
      &lt;Style&gt;
          &lt;Style.Triggers&gt;
              &lt;DataTrigger Binding="{Binding Path=IsLoginWrong}" Value="True"&gt;
                  &lt;DataTrigger.EnterActions&gt;
                      &lt;BeginStoryboard Storyboard="{StaticResource LoginWrong}"/&gt;
                  &lt;/DataTrigger.EnterActions&gt;
              &lt;/DataTrigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/UserControl.Style&gt;
  </code></pre>
  
  <p>But this throws an exception "A storyboard tree in a Style cannot specify a TargetName"... beause styles canno refer to items specifically.. awesome. so how do I do what I'm trying to do? (play animation if a boolean changes in mvvm)</p>
  
  <p>Thanks</p>