#788 – Flipping an Element Using a Scale Transform
April 1, 2013 2 Comments
You can flip any GUI element, either horizontally or vertically, by using a scale transform.
To flip an element horizontally, you use a ScaleTransform with a ScaleX value of -1.0. To flip an element vertically, you use a ScaleTransform with a ScaleY value of -1.0.
<StackPanel Orientation="Vertical"> <Label Content="Jane Austen" Background="Thistle" HorizontalAlignment="Center" FontSize="16" Margin="10"/> <Label Content="Jane Austen" Background="Thistle" HorizontalAlignment="Center" FontSize="16" Margin="10"> <Label.LayoutTransform> <ScaleTransform ScaleX="-1.0"/> </Label.LayoutTransform> </Label> <Label Content="Jane Austen" Background="Thistle" HorizontalAlignment="Center" FontSize="16" Margin="10"> <Label.LayoutTransform> <ScaleTransform ScaleY="-1.0"/> </Label.LayoutTransform> </Label> </StackPanel>
Pingback: Dew Drop – April 2, 2013 (#1,518) | Alvin Ashcraft's Morning Dew
Pingback: #801 – Creating a Mirror Image Using a RenderTransform | 2,000 Things You Should Know About WPF