Ugrás a tartalomhoz

## .NET Programming Technologies

Gergely Kovásznai, Csaba Biró

Eszterházy Károly College

8. fejezet - Transformations (written by Csaba Biró)

## 8. fejezet - Transformations (written by Csaba Biró)

We will discuss about the transformation in this chapter. All Ulelement objects are transformable through the features of RenderTransform and LayoutTransform. With the help of transformations individual elements’mapping can be modified.

Transform class inhertited:

1. TranslateTransform,

2. SkaleTransform,

3. RotateTransform,

4. SkewTransform,

5. MatrixTransform,

6. TransformGroup.

Each transformation class derived from the System.Windows.Media.Transform one.

## TranslateTransform

TranslateTransform can help you to change the location of an item.

Properties:

1. X        the extent of the x-axis offset of the item,

2. Y         the scale on the y-axis offset of the item.

1 0 0 0 1 0 dx dy 1 left [matrix {1 # 0 # 0 ## 0 # 1 # 0 ## dx # dy # 1} right ]

3 x 3 matrix

Example VIII.1  TranslateTransform

VIII.1. TranslateTransform

<Window x:Class="Transzformaciok.MainWindow"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Title="TranslateTransform" Height="205" Width="600">

<Grid>

<StackPanel>

<Rectangle Height="120" Width="150" HorizontalAlignment="Left">

<Rectangle.Fill>

<ImageBrush ImageSource="images/car.jpg"/>

</Rectangle.Fill>

<Rectangle.RenderTransform>

<TranslateTransform X="{Binding ElementName=slider1, Path=Value}"/>

</Rectangle.RenderTransform>

</Rectangle>

<Line X1="0" X2="600" Stroke="Green" StrokeThickness="40"/>

<Slider x:Name="slider1" Minimum="0" Maximum="600" Background="Green"/>

</StackPanel>

</Grid>

</Window>