views:

181

answers:

2

Hi Guys

I know you can do this to get vertical text in a tab header:

<Window x:Class="Abodemploy.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">  
    <Grid>  
        <TabControl Margin="0" Name="tabControl1" FlowDirection="LeftToRight" TabStripPlacement="Left">  
            <TabItem>  
                <TabItem.Header>  
                    <StackPanel Orientation="Horizontal">  
                        <TextBlock>Homes</TextBlock>  
                    </StackPanel>  
                </TabItem.Header>  
                <TabItem.LayoutTransform>  
                <TransformGroup>  
                    <RotateTransform Angle="90" />  
                </TransformGroup>  
                </TabItem.LayoutTransform>  
                <Grid />  
            </TabItem>  
        </TabControl>  
    </Grid>  
</Window>  

However the text letters are sideways. What I'd like (if possible) is for the letter orientation to be correct (ie upwards), but the text flow downwards, is this possible, or am I just dreaming the impossible dream?

Thanks Psy

A: 

Do you ask for this?

 <TabItem.Header>  
      <StackPanel>  
            <TextBlock>H</TextBlock>  
            <TextBlock>o</TextBlock>
            <TextBlock>m</TextBlock>  
            <TextBlock>e</TextBlock>
            <TextBlock>s</TextBlock>
      </StackPanel>  
 </TabItem.Header>  
ArsenMkrt
+1  A: 

I think the following post answers your question: vertical-text-in-wpf-textblock

and I was able to get the desired result as follows:

XAML

<Window x:Class="Test.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">
    <Grid>
        <TabControl Margin="0" Name="tabControl1" FlowDirection="LeftToRight" TabStripPlacement="Left">
            <TabItem>
                <TabItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock >
                            <ItemsControl x:Name="ic"></ItemsControl>
                        </TextBlock>
                    </StackPanel>
                </TabItem.Header>
                <Grid />
            </TabItem>
        </TabControl>
    </Grid>
</Window>

And then set the ItemsSource of the ItemsControl to the string you want in the code behind.

Leom Burke
Yes, I was looking for a similar question and couldn't find it, then when I was looking for a different issue I came across this answer, and yup, it works
Psytronic
Nice, this worked well.
Jacob Reyes
Had to make a few changes, and now the tab headers are stupidly wide, but its what I needed
Psytronic
Cool - glad you got it sorted
Leom Burke