2 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 x:Class="Microsoft.Samples.Graphics.Transforms.ScaleTransformExample"
5 WindowTitle="ScaleTransform Example" Background="White">
7 <Style TargetType="{x:Type TextBlock}">
8 <Setter Property="Margin" Value="0,10,0,0" />
10 <Style TargetType="{x:Type Border}">
11 <Setter Property="BorderBrush" Value="Black" />
12 <Setter Property="BorderThickness" Value="1" />
13 <Setter Property="Background" Value="{StaticResource MyBlueGridBrushResource}" />
14 <Setter Property="HorizontalAlignment" Value="Left" />
15 <Setter Property="VerticalAlignment" Value="Top" />
17 <Style TargetType="{x:Type Rectangle}" x:Key="MarkerRectangleStyle">
18 <Setter Property="Height" Value="50" />
19 <Setter Property="Width" Value="50" />
20 <Setter Property="Stroke" Value="#99000000" />
21 <Setter Property="StrokeDashArray" Value="4,1" />
22 <Setter Property="StrokeThickness" Value="2" />
23 <Setter Property="Canvas.Left" Value="100" />
24 <Setter Property="Canvas.Top" Value="100" />
28 <StackPanel Orientation="Horizontal">
30 <StackPanel Margin="10">
31 <TextBlock>No scale</TextBlock>
33 <Canvas Width="250" Height="250">
35 Height="50" Width="50" Fill="#CCCCCCFF"
36 Canvas.Left="100" Canvas.Top="100" />
40 <TextBlock>ScaleX: 2<LineBreak/>ScaleY: 2<LineBreak/>Center: (0,0)</TextBlock>
42 <Canvas Width="250" Height="250">
44 <!-- Scales a rectangle by 200% from a center of (0,0).-->
45 <Rectangle Height="50" Width="50" Fill="#CCCCCCFF"
46 Stroke="Blue" StrokeThickness="2"
47 Canvas.Left="100" Canvas.Top="100">
48 <Rectangle.RenderTransform>
49 <ScaleTransform CenterX="0" CenterY="0" ScaleX="2" ScaleY="2" />
50 </Rectangle.RenderTransform>
53 <!-- Marks the size and position of the rectangle
55 <Rectangle Style="{StaticResource MarkerRectangleStyle}" />
60 <StackPanel Margin="10">
61 <TextBlock>ScaleX: 2<LineBreak/>ScaleY: 2<LineBreak/>Center: (25,25)</TextBlock>
63 <Canvas Width="250" Height="250">
65 <!-- Scales a rectangle by 200% from a center of (25,25).-->
66 <Rectangle Height="50" Width="50" Fill="#CCCCCCFF"
67 Canvas.Left="100" Canvas.Top="100" Stroke="Blue" StrokeThickness="2">
68 <Rectangle.RenderTransform>
69 <ScaleTransform CenterX="25" CenterY="25" ScaleX="2" ScaleY="2" />
70 </Rectangle.RenderTransform>
73 <!-- Marks the size and position of the rectangle
75 <Rectangle Style="{StaticResource MarkerRectangleStyle}" />
79 <TextBlock>ScaleX: 0.5<LineBreak/>ScaleY: 0.5<LineBreak/>Center: (25,25)</TextBlock>
81 <Canvas Width="250" Height="250">
82 <Rectangle Height="50" Width="50" Fill="#CCCCCCFF"
83 Stroke="Blue" StrokeThickness="2"
84 Canvas.Left="100" Canvas.Top="100">
85 <Rectangle.RenderTransform>
86 <ScaleTransform CenterX="25" CenterY="25" ScaleX="0.5" ScaleY="0.5" />
87 </Rectangle.RenderTransform>
90 <!-- Marks the size and position of the rectangle
92 <Rectangle Style="{StaticResource MarkerRectangleStyle}" />
96 <StackPanel Margin="10">
97 <TextBlock>ScaleX: 2<LineBreak/>ScaleY: 2<LineBreak/>RenderTransformOrigin: (0.5,0.5)</TextBlock>
99 <Canvas Width="250" Height="250">
101 <!-- Scales a rectangle by 200% from a center of (0.5,0.5).-->
102 <Rectangle Height="50" Width="50" Fill="#CCCCCCFF"
103 Canvas.Left="100" Canvas.Top="100" Stroke="Blue" StrokeThickness="2"
104 RenderTransformOrigin="0.5,0.5">
105 <Rectangle.RenderTransform>
106 <ScaleTransform ScaleX="2" ScaleY="2" />
107 </Rectangle.RenderTransform>
110 <!-- Marks the size and position of the rectangle
112 <Rectangle Style="{StaticResource MarkerRectangleStyle}" />
116 <TextBlock>ScaleX: 0.5<LineBreak/>ScaleY: 0.5<LineBreak/>RenderTransformOrigin: (0.25,0.25)</TextBlock>
118 <Canvas Width="250" Height="250">
119 <Rectangle Height="50" Width="50"
120 Fill="#CCCCCCFF" Stroke="Blue" StrokeThickness="2"
121 Canvas.Left="100" Canvas.Top="100"
122 RenderTransformOrigin="0.25,0.25">
123 <Rectangle.RenderTransform>
124 <ScaleTransform ScaleX="2" ScaleY="2" />
125 </Rectangle.RenderTransform>
128 <!-- Marks the size and position of the rectangle
130 <Rectangle Style="{StaticResource MarkerRectangleStyle}" />