The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Rotate an Image

This example shows how to rotate an image 90 degrees by using a Rotation property of a BitmapImage.


<Image Width="150" Margin="5" Grid.Column="0" Grid.Row="1">
     <BitmapImage UriSource="/sampleImages/watermelon.jpg" Rotation="Rotate90" />

//Create Image element
Image rotated270 = new Image();
rotated270.Width = 150;

//Create source
BitmapImage bi = new BitmapImage();
//BitmapImage properties must be in a BeginInit/EndInit block
bi.UriSource = new Uri(@"pack://application:,,/sampleImages/watermelon.jpg");
//Set image rotation
bi.Rotation = Rotation.Rotate270;
//set image source
rotated270.Source = bi;

See Also

Other Resources

Image Element Sample

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft