<Window x:Class="Workspace.DockExample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Workspace" Width="640" Height="480"> <Canvas Width="250" Height="250"> <Rectangle Height="50" Width="50" Fill="#CCCCCCFF" Canvas.Left="100" Canvas.Top="100" Stroke="Blue" StrokeThickness="2" RenderTransformOrigin="0.5,0.5"> <Rectangle.RenderTransform> <ScaleTransform ScaleX="2" ScaleY="2" /> </Rectangle.RenderTransform> </Rectangle> <Rectangle Style="{StaticResource MarkerRectangleStyle}" /> </Canvas> </Window>
Windows Presentation Foundation
ScaleX: 0.5 /ScaleY: 0.5 /Center: (25,25)
<Window x:Class="Workspace.DockExample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Workspace" Width="640" Height="480"> <Canvas Width="250" Height="250"> <Rectangle Height="50" Width="50" Fill="#CCCCCCFF" Stroke="Blue" StrokeThickness="2" Canvas.Left="100" Canvas.Top="100"> <Rectangle.RenderTransform> <ScaleTransform CenterX="25" CenterY="25" ScaleX="0.5" ScaleY="0.5" /> </Rectangle.RenderTransform> </Rectangle> <Rectangle Style="{StaticResource MarkerRectangleStyle}" /> </Canvas> </Window>
Scales a rectangle by 200% from a center of (25,25)
<Window x:Class="Workspace.DockExample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Workspace" Width="640" Height="480"> <Canvas Width="250" Height="250"> <Rectangle Height="50" Width="50" Fill="#CCCCCCFF" Canvas.Left="100" Canvas.Top="100" Stroke="Blue" StrokeThickness="2"> <Rectangle.RenderTransform> <ScaleTransform CenterX="25" CenterY="25" ScaleX="2" ScaleY="2" /> </Rectangle.RenderTransform> </Rectangle> <Rectangle Style="{StaticResource MarkerRectangleStyle}" /> </Canvas> </Window>
Scales a rectangle by 200% from a center of (0,0)
<Window x:Class="Workspace.DockExample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Workspace" Width="640" Height="480"> <Canvas Width="250" Height="250"> <Rectangle Height="50" Width="50" Fill="#CCCCCCFF" Stroke="Blue" StrokeThickness="2" Canvas.Left="100" Canvas.Top="100"> <Rectangle.RenderTransform> <ScaleTransform CenterX="0" CenterY="0" ScaleX="2" ScaleY="2" /> </Rectangle.RenderTransform> </Rectangle> <Rectangle Style="{StaticResource MarkerRectangleStyle}" /> </Canvas> </Window>
Scale the text using a ScaleTransform
<Window x:Class="SDKSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Text Transform Samples" Background="FloralWhite" Height="640"> <StackPanel> <TextBlock FontSize="32" FontWeight="Bold" Foreground="SteelBlue" Text="asdf" Margin="100, 0, 0, 0"> <TextBlock.RenderTransform> <ScaleTransform ScaleX="1.5" ScaleY="1.0" /> </TextBlock.RenderTransform> </TextBlock> <TextBlock FontSize="32" FontWeight="Bold" Foreground="SteelBlue" Text="{Binding Path=Text, ElementName=textblockScaleMaster}" Margin="100, 0, 0, 0"> <TextBlock.RenderTransform> <ScaleTransform ScaleX="1.0" ScaleY="1.5" /> </TextBlock.RenderTransform> </TextBlock> </StackPanel> </Window>
Skew the text using a SkewTransform
<Window x:Class="SDKSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Text Transform Samples" Background="FloralWhite" Height="640"> <StackPanel> <TextBlock FontSize="32" FontWeight="Bold" Foreground="Maroon" Text="Skewed Text" Margin="125, 0, 0, 0"> <TextBlock.RenderTransform> <SkewTransform AngleX="-30" AngleY="0" /> </TextBlock.RenderTransform> </TextBlock> <TextBlock FontSize="32" FontWeight="Bold" Foreground="Maroon" Text="asdf" Margin="100, 0, 0, 0"> <TextBlock.RenderTransform> <SkewTransform AngleX="30" AngleY="0" /> </TextBlock.RenderTransform> </TextBlock> </StackPanel> </Window>
Skew the text using a TranslateTransform
<Window x:Class="SDKSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Text Transform Samples" Background="FloralWhite" Height="640"> <StackPanel> <TextBlock FontSize="32" FontWeight="Bold" Foreground="Black" Text="asdf" Margin="100, 0, 0, 0"> <TextBlock.RenderTransform> <TranslateTransform X="2" Y="2" /> </TextBlock.RenderTransform> </TextBlock> </StackPanel> </Window>