In this tip, i will show you how to apply multiple transformation. In the above picture, it is rotated 180 and enlarged many times than its original width and height given.
MainPage.xaml
<UserControl xmlns:my=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data” x:Class=”Tips.MainPage”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation“
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“
xmlns:d=”http://schemas.microsoft.com/expression/blend/2008“
xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006“
mc:Ignorable=”d”
xmlns:local=”clr-namespace:Tips”
d:DesignHeight=”300″ d:DesignWidth=”400″>
<Grid x:Name=”LayoutRoot”>
<Image MouseLeftButtonDown=”Rectangle_MouseLeftButtonDown” Width=”50″ Height=”50″ Source=”images/8312_Sony_VIAO_Notebooks.jpg”>
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name=”scale” />
<RotateTransform Angle=”180″ />
</TransformGroup>
</Image.RenderTransform>
</Image>
</Grid>
</UserControl>
MainPage.xaml.cs
using System.Windows.Controls;
using System.Windows.Input;
namespace Tips
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void Rectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
scale.ScaleX = scale.ScaleX * 1.25;
scale.ScaleY = scale.ScaleY * 1.25;
}
}
}
Sharker Khaleed Mahmud
Software Developer




