title: Trigger Animations
body: <p>I have a usercontrol that when I double click on it, I want it to zoom in, if it's not already. If it is, then the double click will zoom out on it. I can get it to work with code behind, but I can't get it to work in xaml. 
  Here is the code behind that handle's the double click event. </p>
  
  <pre><code>void MyObjectMouseDoubleClick(object sender, MouseButtonEventArgs e)
      {
          if (IsZoomedIn)
          {
              IsZoomedIn = false;
              //ZoomOutAnimation();
          }
          else
          {
              IsZoomedIn = true;
              //ZoomInAnimation();
          }
      }
  </code></pre>
  
  <p>then in my xaml:</p>
  
  <pre><code>&lt;UserControl.RenderTransform&gt;
      &lt;TransformGroup&gt;
          &lt;RotateTransform /&gt;
          &lt;ScaleTransform /&gt;
          &lt;TranslateTransform /&gt;
      &lt;/TransformGroup&gt;
  &lt;/UserControl.RenderTransform&gt;
  
  &lt;UserControl.Style&gt;
      &lt;Style&gt;
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="local:MyObject.IsZoomedIn" Value="False"&gt;
                  &lt;Trigger.EnterActions&gt;
                      &lt;BeginStoryboard&gt;
                          &lt;Storyboard&gt;
                              &lt;DoubleAnimation Storyboard.TargetProperty="(UserControl.
                              RenderTransform).(TransformGroup.Children)[1].
                              (ScaleTransform.ScaleX)" To="1" Duration="0:0:.3" /&gt;
                              &lt;DoubleAnimation Storyboard.TargetProperty="(UserControl.
                              RenderTransform).(TransformGroup.Children)[1].
                              (ScaleTransform.ScaleY)" To="1" Duration="0:0:.3" /&gt;
                          &lt;/Storyboard&gt;
                      &lt;/BeginStoryboard&gt;
                  &lt;/Trigger.EnterActions&gt;
              &lt;/Trigger&gt;
              &lt;Trigger Property="local:MyObject.IsZoomedIn" Value="True"&gt;
                  &lt;Trigger.EnterActions&gt;        
                  &lt;BeginStoryboard&gt;
                      &lt;Storyboard&gt;
                          &lt;DoubleAnimation Storyboard.TargetProperty="(UserControl.
                          RenderTransform).(TransformGroup.Children)[1].
                          (ScaleTransform.ScaleX)" To="2" Duration="0:0:.3" /&gt;
                          &lt;DoubleAnimation Storyboard.TargetProperty="(UserControl.
                          RenderTransform).(TransformGroup.Children)[1].
                          (ScaleTransform.ScaleY)" To="2" Duration="0:0:.3" /&gt;
                      &lt;/Storyboard&gt;
                  &lt;/BeginStoryboard&gt;
                  &lt;/Trigger.EnterActions&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/UserControl.Style&gt;
  </code></pre>
  
  <p>Once it zooms in on my usercontrol, the zoom out animation doesn't work. Any help appreciated. <br />
  Thanks.</p>