WPF中的选项卡样式
开发工具与关键技术:Visual Studio 2017、WPF
作者:ZWJ
撰写时间:2019年8月6日
下面我们做一个选项卡的样式,原始的选项卡样式不是很好看,我们可以去定义自己喜欢的选项卡样式,我们在本页面定义了一个静态资源,这个静态资源是选项卡的样式,在页面里定义的资源只能在本页面生效,具体的选项卡样式看下面代码:
XAML代码如下:
<Window.Resources>
<Style TargetType="TabItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border x:Name="bd" Margin="0 0 0 0" Background="Transparent" BorderThickness="1 1 1 0" BorderBrush="#035b72" CornerRadius="0 30 0 0">
<TextBlock x:Name="txt" Margin="0 0 20 0" Text="{TemplateBinding Header}" Foreground="#ddd" VerticalAlignme