title: Rotate Image in Button on Click
body: <p>I want the image in the button to rotate +90 degrees or -90 degrees (dependent on the current angle) when the button is clicked. I tried a few solutions, but I only could make the whole button rotate instead of only the image inside it.</p>
  <p>Here's the code I have so far (style attributes etc. omitted for readability):</p>
  <pre><code>&lt;Button Width="110">
      &lt;StackPanel Orientation="Horizontal">
          &lt;TextBlock Text="Options" />
          &lt;Image RenderTransformOrigin="0.5, 0.5" Source="../../Images/gt.png">
              &lt;Image.RenderTransform>
                  &lt;RotateTransform x:Name="AnimatedRotateTransform" Angle="0" />
              &lt;/Image.RenderTransform>
              &lt;Image.Triggers>
                  &lt;EventTrigger  RoutedEvent="Button.Click">
                      &lt;BeginStoryboard>
                          &lt;Storyboard>
                              &lt;DoubleAnimation Storyboard.TargetName="AnimatedRotateTransform" Storyboard.TargetProperty="Angle" To="90" Duration="0:0:5" FillBehavior="Stop" />
                          &lt;/Storyboard>
                      &lt;/BeginStoryboard>
                  &lt;/EventTrigger>
              &lt;/Image.Triggers>
          &lt;/Image>
      &lt;/StackPanel>
  &lt;/Button></code></pre>
  <p>This is what the button looks like (the little arrow should point down when I click once, and then point right when I click again:</p>
  <p><img src="https://i.stack.imgur.com/TNW9U.png" alt="This is what the button looks like" /></p>
  <p>Anyone has an idea?</p>
  <p>Edit: .NET 4.0, using Visual Studio 2010. Oh, and solving this &quot;code-behind&quot; is not an option.</p>