Hello everybody,
currently I'm working on a Program to design UI Controls on a Canvas.
I want to rotate Controls by default in the Center (RenderTransformOrigin="0.5,0.5"). If I now apply a Rotation Angle (for example 45°) using a RotateTransform, everything is working as expected (it's rotated at Center of Control by 45°).
But if the User changes the Rotation Point (for example change RenderTransformOrigin to 1,1), the Control moves. It means, that changing RenderTransformOrigin applies the existing RotateTransform. But my aim is, that the new RenderTransformOrigin (1,1)
should only be applied to future rotations and leave the original position of the Control.
Is it possible, to turn off this behaviour?
I have seen that MS Blend uses a TransformGroup with a TranslateTranform to leave the Control on the original Position:
<Rectangle Fill="Blue" Height="200" Margin="114,101,150,0" VerticalAlignment="Top" Width="200" RenderTransformOrigin="1.506,0.866"><Rectangle.RenderTransform><TransformGroup><ScaleTransform/><SkewTransform/><RotateTransform Angle="45"/><TranslateTransform X="-110.694" Y="120.83"/></TransformGroup></Rectangle.RenderTransform></Rectangle>
How does MS Blend calculate the correct TranslateTransform?
Can you please help me?
Thank you a lot.
Kind regards
Stefan