Place headers for TabControl right and vertical text

Sorry for my English.

I need to place the headers for the TabControl on the right and vertically place the text. I wrote the XAML code:

<TabControl Grid.ColumnSpan="2" Grid.Row="1" HorizontalAlignment="Stretch" 
            Name="tabControl1" VerticalAlignment="Stretch"  Grid.RowSpan="2" 
            TabStripPlacement="Right">
    <TabItem Name="tabItem1">
        <TabItem.Header>
            <TextBlock Margin="3">
                <TextBlock.RenderTransform>
                    <RotateTransform CenterX="0" CenterY="0" Angle="90" />
                </TextBlock.RenderTransform>
                <TextBlock.Text>
                    123 444 555 666
                </TextBlock.Text>
            </TextBlock>
        </TabItem.Header>
    </TabItem>
    <TabItem Name="tabItem2">
        <TabItem.Header>
            <TextBlock Margin="3">
                <TextBlock.RenderTransform>
                    <RotateTransform CenterX="0" CenterY="0" Angle="90" />
                </TextBlock.RenderTransform>
                <TextBlock.Text>
                    ABCDEF
                </TextBlock.Text>
            </TextBlock>
        </TabItem.Header>
    </TabItem>
</TabControl>

I get the result:

enter image description here

The result was bad. How to do it right?

+3
source share
1 answer

You need to use LayoutTransform. a RenderTransformdoes not recount the size of the parent control.

+4
source

All Articles