title: WPF rotate content/background of button on mouse over
body: <p>I'm trying to rotate the content or background of my button when the mouse hovers the button.</p>
  
  <p>Not sure if this is the correct way to do it but i'm stuck:</p>
  
  <pre><code> &lt;Button Width="48" Height="48" Grid.Column="1"
                  BorderThickness="0"&gt;
        &lt;Button.Triggers&gt;
          &lt;EventTrigger RoutedEvent="Button.MouseEnter"&gt;
            &lt;BeginStoryboard&gt;
              &lt;Storyboard&gt;
                &lt;DoubleAnimation Storyboard.TargetName="xxx" 
                                 Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                 By="-360" Duration="0:0:4"
                                 AutoReverse="False" RepeatBehavior="Forever" /&gt;
              &lt;/Storyboard&gt;
            &lt;/BeginStoryboard&gt;
          &lt;/EventTrigger&gt;
        &lt;/Button.Triggers&gt;
        &lt;Button.Background&gt;
          &lt;VisualBrush&gt;
            &lt;VisualBrush.Visual&gt;
              &lt;Grid x:Name="xxx" RenderTransformOrigin="0.5,0.5" Width="48" Height="48"&gt;
                &lt;Rectangle Fill="Blue" Width="48" Height="48" /&gt;
                &lt;Rectangle Fill="Green" Width="14" Height="14" /&gt;
                &lt;Grid.RenderTransform&gt;
                  &lt;RotateTransform /&gt;
                &lt;/Grid.RenderTransform&gt;
              &lt;/Grid&gt;
            &lt;/VisualBrush.Visual&gt;
          &lt;/VisualBrush&gt;
        &lt;/Button.Background&gt;
      &lt;/Button&gt;
  </code></pre>
  
  <p>My button is originally like this, and it needs to rotate the content (Grid in this case):</p>
  
  <pre><code>         &lt;Button Width="48" Height="48" Grid.Column="1"
                  BorderThickness="0"&gt;
              &lt;Grid&gt;
                &lt;Rectangle Fill="Blue" Width="48" Height="48" /&gt;
                &lt;Rectangle Fill="Green" Width="14" Height="14" /&gt;
              &lt;/Grid&gt;
      &lt;/Button&gt;
  </code></pre>
  
  <p>I tried via a style but also stuck. :s</p>