【发布时间】:2013-04-28 07:57:59
【问题描述】:
我在 WPF 中使用 TabControl 类,我注意到每个 TabItem 的内容在所有边都有 4 个像素的默认边距。
示例代码:
<Window x:Class="TabControlPadding.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="10">
<TabItem Header="Tab 1">
<Grid Background="Pink"/>
</TabItem>
<TabItem Header="Tab 2">
<Grid Background="LightBlue"/>
</TabItem>
</TabControl>
</Grid>
</Window>
截图:
我想去掉这个边距(减少到零),但我不希望完全替换模板或类似的东西。
有没有一种简单的方法可以非常有针对性地做到这一点?
【问题讨论】:
标签: wpf tabcontrol margin tabitem