如标题所述,我想将我的TabControl的标题更改为可滚动的。
原因是:我有太多的tabItem,换行对我来说不是最好的解决方案。因此,我想将其更改为:
(有箭头指示的滚动条):
请问有人可以帮助我,并展示如何做到这一点吗?(我正在使用wpf)
原因是:我有太多的tabItem,换行对我来说不是最好的解决方案。因此,我想将其更改为:
(有箭头指示的滚动条):
请问有人可以帮助我,并展示如何做到这一点吗?(我正在使用wpf)
对我来说,将TabControl.Template
更改为类似于这样简单的东西似乎有效。
<TabControl ...>
<TabControl.Template>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
<TabPanel x:Name="HeaderPanel" IsItemsHost="True" Margin="0,4,0,0"/>
</ScrollViewer>
<ContentPresenter x:Name="PART_SelectedContentHost" Margin="4" ContentSource="SelectedContent" Grid.Row="1"/>
</Grid>
</ControlTemplate>
</TabControl.Template>
</TabControl>