WPF实现纵向显示TabControl标题栏通过设置TabStripPlacement属性,标题字体纵向显示则可通过改变TabItem样式,在其中加入TextBlock控件,使用TextWrapping="Wrap"的特性来实现,具体效果如图:
窗体xaml :
<Window x:Class="VerticalTabDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VerticalTabDemo"
mc:Ignorable="d"
Title="VerticalTabDemo" Height="400" Width="525">
<Window.Resources>
<!--TextBlock样式-->
<Style x:Key="TextBlockStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Black"></Setter>
<Setter Property="FontSize" Value="26"></Setter>
<Setter Property="TextWrapping" Value="Wrap"></Setter>
<Setter Property="TextAlignment" Value="Center"></Setter>
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Bottom"></Setter>
<Setter Property="Height" Value="100"></Setter>
</Style>
<!--Tab样式--