I am only writing about this to justify how long this took me to figure out. Now that I know the relation, or lack thereof, between the two it is trivial. I have been working with some third party controls for WPF that allow panels to be moved around, docked and hidden just like the toolbox and solution windows in visual studio. While they make that easy styling the controls isn’t as straight forward. You need to create a resource dictionary and override templates with certain names. As far as docking goes I needed the text to be either normal if on the top or bottom or have the textblock be “sideways” if the panel was hidden on the side.

 

I decided that I would use the rotate transform to turn the textblock 90 degrees. I used a RenderTransformOrigin of “0,0” to turn it from the top left. When I viewed the app the text was no where to be found. I then decided to add some margin values. My mistake was that I thought once I rotated the object that the margins also rotated so that the left margin was in effect now the top margin. It turns out that is not the case. Had I would have just made a simple window with one control and not kept changing values in the resource file I would have noticed it in about 3 seconds. I know this because after I realized what was going on I made a simple window like the one below and my button was off the screen. Giving it a left margin of 20 put it the whole way down the side of the window. Code and frustration below.

 

<Window x:Class="RotateTransformTest.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <StackPanel>
        <Button RenderTransformOrigin="0,0" Margin="20,0,0,0">
            <Button.RenderTransform>
                <RotateTransform Angle="90" />
            </Button.RenderTransform>
            test
        </Button>
    </StackPanel>
</Window>