#767 – Transform Basics

In WPF, you can easily apply one or more 2D transforms to user interface elements.  A transform is a mathematical function applied to a user interface element that does one or more of the following:

  • Scales the element – make it bigger or smaller
  • Rotates the element – spin the element around some point
  • Translates the element – move the element up/down/left/right
  • Skews the element – tilt the element, e.g. turn a rectangular element into a rhomboid

In the example below, the second label has a rotation transform applied to it, which rotates it by 15 degrees (clockwise).

    <StackPanel Orientation="Horizontal">
        <Label Content="Grand Canyon" Background="LightPink"
               VerticalAlignment="Center" Margin="5"/>
        <Label Content="Grand Tetons" Background="Bisque"
               VerticalAlignment="Center" Margin="5" >
            <Label.RenderTransform>
                <RotateTransform Angle="15"/>
            </Label.RenderTransform>
        </Label>
    </StackPanel>

764-001

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

3 Responses to #767 – Transform Basics

  1. Alian says:

    Hey man, just to leave you a post for contratulation, sorry for my English, I’m spanish speaker. WPF is one of my interests, I aprecciate to much your post, thanks.

  2. Pingback: Dew Drop – March 1, 2013 (#1,507) | Alvin Ashcraft's Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: