WPF C#

  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="ImageElementExample.TransformedImageExample"
    Title="Transformed Image Example"
    Loaded="PageLoaded">
   
      
   

   
      
      
         
           
             
               
                 
               

             
           

         
      
   


//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Controls;
using System.Windows.Navigation;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace ImageElementExample
{
   public partial class TransformedImageExample : Page
   {
      public TransformedImageExample()
      {
      }
      public void PageLoaded(object sender, RoutedEventArgs args)
      {
         Image rotated90 = new Image();
         rotated90.Width = 150;
         TransformedBitmap tb = new TransformedBitmap();
         BitmapImage bi = new BitmapImage();
         bi.BeginInit();
         bi.UriSource = new Uri(@"file:///c:/image.jpg", UriKind.RelativeOrAbsolute);
         bi.EndInit();
         tb.BeginInit();
         tb.Source = bi;
         RotateTransform transform = new RotateTransform(90);
         tb.Transform = transform;
         tb.EndInit();
         rotated90.Source = tb;
         Grid.SetColumn(rotated90, 1);
         Grid.SetRow(rotated90, 1);
         transformedGrid.Children.Add(rotated90);
      }
   }
}