0

I am making an Wp7 application where I need to rotate image with the 20 degree left or right. When I change the angle of rotation of Image , it does rotate but the rotation is from down side of this image

Following is the image snap shot at its normal position i.e

     <Image.RenderTransform>
                <RotateTransform Angle=" 0" CenterX="  0" CenterY="  0" />
      </Image.RenderTransform>

enter image description here

and after changing the angle let say to 20 degree , image rotate in this way ( from downside)

            <Image.RenderTransform>
                <RotateTransform Angle=" 20" CenterX="  0" CenterY="  0" />
            </Image.RenderTransform>

enter image description here

But I want this image to rotate from above[top] side.Currently it seems like the axis of rotation is at top corner of this image but I want it to be at bottom so that this image can rotate from above side.

Please help, Thanks in advance

Zeshan Aman
  • 103
  • 3
  • 13

1 Answers1

0

You should try setting the CenterX and CenterY properties to match the bottom left corner of your image, based on the size of the image.

When you use a RotateTransform, realize that the transformation rotates the coordinate system for a particular object about the point (0, 0). Therefore, depending on the position of the object, it might not rotate in place (around its center). For example, if an object is positioned 200 units from 0 along the x-axis, a rotation of 30 degrees can swing the object 30 degrees along a circle that has a radius of 200, which is drawn around the origin. To rotate an object in place, set the CenterX and CenterY of the RotateTransform to the center of the object to rotate.

RotateTransform.CenterX Property @ MSDN

Igor Ralic
  • 14,975
  • 4
  • 43
  • 51