SkewTransform in Silverlight


The example shown below skew an image to 45 degrees from a center point of (25, 25).

<
UserControl
          xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
          xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
          x:Class="imginSL.MainPage"
          Width="640" Height="480">
          <Grid x:Name="LayoutRoot" Background="White">
                   <Image x:Name="img" Margin="151,127,208,142" Source="Waterfall.jpg" Stretch="Fill">
                   <Image.RenderTransform>
                             <SkewTransform CenterX="25" CenterY="25" AngleX="45" AngleY="0"></SkewTransform>    
                 </Image.RenderTransform>
                   </Image>
          </Grid>
</UserControl>

We can do the same from code behind.

SkewTransform
skew = new SkewTransform();
skew.AngleX = 45;
skew.AngleY = 0;
skew.CenterX = 25;
skew.CenterY = 25;
img.RenderTransform = skew;


Output:

1.gif