How to do rotation around control's center in XAML

I want do rotate button to 90 degrees but it gets clipped because it rotates arount (0,0). How to make it rotate around center if I don't know it't width in pixels (it's a template for many buttons)


You have to set the control's RenderTransformOrigin to 0.5, 0.5.

ex.:

<Button RenderTransformOrigin="0.5, 0.5">
    <RepeatButton.RenderTransform>
        <RotateTransform Angle="90"/>
    </RepeatButton.RenderTransform>
</RepeatButton>

<Button ...>
  <Button.LayoutTransform>
    <RotateTransform CenterX="0.5" CenterY="0.5" Angle="90"/>
  </Button.LayoutTransform>
</Button>