How to build vertical tab sets in WPF?

WpfTabcontrol

Wpf Problem Overview


How to build vertical tab sets in WPF? The tabs will stack up in top-to-bottom just like the "Properties" of a project shown in visual studio.

Wpf Solutions


Solution 1 - Wpf

Have you tried the TabControl.TabStripPlacement Property?

> The following example creates a tab control that positions the tabs on the left side.

<TabControl TabStripPlacement="Left" Margin="0, 0, 0, 10">
  <TabItem Name="fontweight" Header="FontWeight">
    <TabItem.Content>
      <TextBlock TextWrapping="WrapWithOverflow">
        FontWeight property information goes here.
      </TextBlock>
    </TabItem.Content>
  </TabItem>

  <TabItem Name="fontsize" Header="FontSize">
    <TabItem.Content>
      <TextBlock TextWrapping="WrapWithOverflow">
        FontSize property information goes here.
      </TextBlock>
    </TabItem.Content>
  </TabItem>
</TabControl>

Solution 2 - Wpf

You should try this code:

<TabControl.Resources>
            <Style TargetType="{x:Type TabItem}">
                <Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <ContentPresenter Content="{TemplateBinding Content}">
                                <ContentPresenter.LayoutTransform>
                                    <RotateTransform Angle="270" />
                                </ContentPresenter.LayoutTransform>
                            </ContentPresenter>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Padding" Value="3" />
            </Style>
        </TabControl.Resources>

Solution 3 - Wpf

Based on rkirac's answer above. If you don't want to create a global style, you can put the same stuff inside TabControl.ItemContainerStyle that will only affect the TabControl in question. Following is a simple example:

<TabControl TabStripPlacement="Left">
  <TabControl.ItemContainerStyle>
    <Style TargetType="TabItem">
      <Setter Property="LayoutTransform">
        <Setter.Value>
          <RotateTransform Angle="270" />
        </Setter.Value>
      </Setter>
    </Style>
  </TabControl.ItemContainerStyle>
</TabControl>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGulshanView Question on Stackoverflow
Solution 1 - WpfChrisFView Answer on Stackoverflow
Solution 2 - WpfrkiracView Answer on Stackoverflow
Solution 3 - WpfdotNETView Answer on Stackoverflow