title: WPF: Change the RotateTransform center before angle animation
body: <p>I want to rotate an animation for my user control which would be triggered when the control gets the keyboard focus. The animation should rotate it around its center.</p>
  <p>The problem is, I set the original center point on the lower left corner of the control for the loaded animation. So, to correct that, I set the center in the middle of the control on the trigger <code>IsFocused</code>.</p>
  <p>But my <code>GetKeyboardFocus</code> animation keep the original center.</p>
  <p>Is the trigger executed after the <code>eventtrigger</code>? Or I'm doing something wrong.</p>
  <pre><code>&lt;UserControl x:Class=&quot;testtuile.rectangle&quot;
           xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
           xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
           xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot; 
           xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot; 
           mc:Ignorable=&quot;d&quot; 
           d:DesignHeight=&quot;300&quot; d:DesignWidth=&quot;300&quot; Height=&quot;150&quot; Width=&quot;300&quot; Padding=&quot;4&quot; Focusable=&quot;True&quot; MouseDown=&quot;UserControl_MouseDown&quot; IsTabStop=&quot;True&quot;&gt;
  &lt;UserControl.RenderTransform&gt;
      &lt;RotateTransform Angle=&quot;0&quot; CenterX=&quot;0&quot; CenterY=&quot;150&quot;&gt;&lt;/RotateTransform&gt;
  &lt;/UserControl.RenderTransform&gt;
  &lt;UserControl.Style&gt;
      &lt;Style&gt;
          &lt;Style.Triggers&gt;
              &lt;Trigger Property=&quot;Control.IsFocused&quot; Value=&quot;True&quot;&gt;
                  &lt;Setter Property=&quot;Control.BorderBrush&quot; Value=&quot;Gold&quot;&gt;&lt;/Setter&gt;
                  &lt;Setter Property=&quot;Control.BorderThickness&quot; Value=&quot;2&quot;&gt;&lt;/Setter&gt;
                  &lt;Setter Property=&quot;Control.RenderTransform&quot;&gt;
                      &lt;Setter.Value&gt;
                          &lt;RotateTransform CenterX=&quot;150&quot; CenterY=&quot;75&quot;/&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/UserControl.Style&gt;
  &lt;UserControl.Triggers&gt;
      &lt;EventTrigger RoutedEvent=&quot;Loaded&quot;&gt;
          &lt;EventTrigger.Actions&gt;
              &lt;BeginStoryboard&gt;
                  &lt;Storyboard&gt;
                      &lt;DoubleAnimation
                          Storyboard.TargetProperty=&quot;(RenderTransform).(RotateTransform.Angle)&quot;
                          From=&quot;90&quot; To=&quot;0&quot; Duration=&quot;0:0:0.8&quot; 
                          AutoReverse=&quot;False&quot; 
                      /&gt;
                      &lt;DoubleAnimation
                          Storyboard.TargetProperty=&quot;Opacity&quot;
                          From=&quot;0&quot; Duration=&quot;0:0:0.6&quot;
                          AutoReverse=&quot;False&quot;
                      /&gt;
                  &lt;/Storyboard&gt;
              &lt;/BeginStoryboard&gt;
          &lt;/EventTrigger.Actions&gt;
      &lt;/EventTrigger&gt;
      &lt;EventTrigger RoutedEvent=&quot;GotKeyboardFocus&quot;&gt;
          &lt;EventTrigger.Actions&gt;
              &lt;BeginStoryboard Name=&quot;ButtonFocusedAnimation&quot;&gt;
                  &lt;Storyboard&gt;
                      
                      &lt;DoubleAnimation
                          Storyboard.TargetProperty=&quot;(RenderTransform).(RotateTransform.Angle)&quot;
                          From=&quot;-2&quot; To=&quot;2&quot; Duration=&quot;0:0:1&quot; 
                          AutoReverse=&quot;True&quot; RepeatBehavior=&quot;Forever&quot; 
                      /&gt;
                  &lt;/Storyboard&gt;
              &lt;/BeginStoryboard&gt;
          &lt;/EventTrigger.Actions&gt;
      &lt;/EventTrigger&gt;
      &lt;EventTrigger RoutedEvent=&quot;LostKeyboardFocus&quot;&gt;
          &lt;StopStoryboard BeginStoryboardName=&quot;ButtonFocusedAnimation&quot; /&gt;
      &lt;/EventTrigger&gt;
  &lt;/UserControl.Triggers&gt;
  
  &lt;Grid Background=&quot;Aquamarine&quot;&gt;
  
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p>Thank you for your help.</p>