这个想法是简单地利用标签(标题)来进行选择,所以“内容”是不必要的。而且我似乎找不到一种简单的方法来使内容“为空”或零高度。
因此,在视觉上,您应该只看到标签,没有其他东西。
这个想法是简单地利用标签(标题)来进行选择,所以“内容”是不必要的。而且我似乎找不到一种简单的方法来使内容“为空”或零高度。
因此,在视觉上,您应该只看到标签,没有其他东西。
要隐藏选项卡的内容,您可以覆盖TabControl的ContentTemplate。
<TabControl>
<TabControl.ContentTemplate>
<DataTemplate/>
</TabControl.ContentTemplate>
</TabControl>
你能否根据MSDN示例自定义ControlTemplate
并删除选定的内容:https://msdn.microsoft.com/en-us/library/ms754137(v=vs.90).aspx
这样它就会变成这样:
<Style TargetType="{x:Type TabControl}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TabPanel
Name="HeaderPanel"
Grid.Row="0"
Panel.ZIndex="1"
Margin="0,0,4,-1"
IsItemsHost="True"
KeyboardNavigation.TabIndex="1"
Background="Transparent" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<TabControl Padding="0" BorderThickness="0">
<TabControl.ContentTemplate>
<DataTemplate>
<Grid/>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>