#285 – Rotating an Image
April 25, 2011 2 Comments
You can rotate an Image control by assigning a rotation transform to its LayoutTransform property.
<Image Source="TractorSm.png"> <Image.LayoutTransform> <RotateTransform Angle="45"/> </Image.LayoutTransform> </Image>
How do you flip an image? I don’t want to rotate it 180 degrees, i just want to flip it so it looks like a reflection of the original. Example, I have a shaded button image with an arrow in it, so instead of it facing left, i’d like to use the same image and make it facing right. When i rotate it 180, it works but the shading is upside down and not the desired intent.
Hi Jim,
There’s a neat trick in XAML for flipping in image. You can just use a scale transform, with a negative value for the ScaleX or ScaleY properties.
I can’t see to post XAML code in a comment, so I’ll do an example in tomorrow’s post on the blog.
Thanks for asking!
Sean