【发布时间】:2013-11-08 16:33:17
【问题描述】:
所以,我希望标签中的标签项水平居中。我还想更改选项卡后面的背景。我找到了这两件事的答案:
This one explains exactly what I want to do for the background and gives a solution
This one explains how to center the tabItems
我遇到的问题是它们都单独工作得很好,但是当它们结合起来时,它们就不起作用了。 tabItems 居中很好,但背景颜色不是我指定的颜色。
例如代码:
<TabControl>
<TabControl.Resources>
<Style TargetType="{x:Type TabPanel}">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Background" Value="Red" />
</Style>
</TabControl.Resources>
<TabItem Header="Test 1" />
<TabItem Header="Test 2" />
<TabItem Header="Test 3" />
<TabItem Header="Test 4" />
</TabControl>
帮助?
【问题讨论】:
标签: c# wpf tabcontrol