locked
rotate transformation problem

    Question

  • when i rotate a label in the right direction 

    but the rotation point isn't (0.0) of the label (... by that it takes a new position)

    and then when i rotate it in the reversed direction it rotates but from the old(start)

    position not from the new position


    • Edited by moslem-dev Saturday, September 13, 2014 9:38 AM
    Saturday, September 13, 2014 9:35 AM

All replies

  • You should set the RenderTransformOrigin property to (0.5, 0.5) if you want to rotate a control arounds its center. It defaults to (0,0) which means that the control will rotate around the top left corner of its bounding box. Please refer to the following page for more information: http://msdn.microsoft.com/en-US/library/windows.ui.xaml.media.rotatetransform.ASPX

    <Grid Background="Yellow" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left">
                <TextBlock>Text...</TextBlock>
                <Grid.RenderTransform>
                    <RotateTransform Angle="45"/>
                </Grid.RenderTransform>
            </Grid>

    And please remember to close your threads by marking helpful posts as answer by clicking on the link below the helpful post.

    • Proposed as answer by Oliver Ulm Saturday, September 13, 2014 10:57 AM
    Saturday, September 13, 2014 10:50 AM
  • thanks, 

    i know that , but

    by c# code i want to simulate a car rotation so the center point won't help me

    too the car return back to its old position when i reversed it's direction


    • Edited by moslem-dev Sunday, September 14, 2014 7:00 AM
    Sunday, September 14, 2014 6:40 AM
  • Hi moslem,

    What do you mean by simulate car rotation? If you want the car back to its old position, you should set Angle value.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 25, 2014 12:03 PM
    Moderator