我使用的是 WPF(C#)。
我想要选项卡 TabControls 位于底部。为此,我使用属性:TabStripPlacement="Bottom"。
但是,由于我的风格,此属性不起作用:
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type TabControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TabPanel IsItemsHost="True" />
<ContentPresenter Grid.Row="1" ContentSource="SelectedContent"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<TabControl TabStripPlacement="Bottom" >
<TabItem Header="tab1">fff</TabItem>
<TabItem Header="tab2"></TabItem>
<TabItem Header="tab3"></TabItem>
</TabControl>
</Grid>
请告诉我,如何修复位于底部的选项卡TabControls?
请您参考如下方法:
移动Grid.Row="1"到 <TabPanel...>元素:
<TabPanel Grid.Row="1" IsItemsHost="True" />
<ContentPresenter ContentSource="SelectedContent"/>
然后,选项卡将显示在内容下方。
