RenderTransform. Controls in WPF support graphical transformations. We can scale, skew, rotate and translate controls. We use the RenderTransform element.
Some details. For a Button, we specify a Button.RenderTransform and a TransformGroup. This allows us to resize and change the rendering of the button.
First, we attempt to rotate the Button in Visual Studio. Click on a corner and drag it in the direction you want to rotate. Visual Studio will insert a Button.RenderTransform element.
Info ScaleTransform is the first element within the TransformGroup element. It scales (makes bigger or smaller) the X and Y dimensions.
Next Skewing an element causes it to lose its original shape. It distorts the element. We set AngleX to 30.
Also RotateTransform rotates the element. We specify a 35-degree rotation of the Button control.
Finally TranslateTransform changes the location of the control. We move it 50 pixels to the right (X) and 80 pixels downward (Y).
The screenshot at shows the output of this XAML. The button, salmon-colored with white text, is rotated and skewed and scaled. This makes it almost unusable in a real program.
A summary. Any WPF control can be transformed in this way. But in many programs, these transformations are not helpful. It is best to be careful and apply transformations only as needed.
Dot Net Perls is a collection of pages with code examples, which are updated to stay current. Programming is an art, and it can be learned from examples.
Donate to this site to help offset the costs of running the server. Sites like this will cease to exist if there is no financial support for them.
Sam Allen is passionate about computer languages, and he maintains 100% of the material available on this website. He hopes it makes the world a nicer place.