Due to popular demand and new tabs panel customization capabilities in Tabs Studio v2.1.2, I’ve created the SingleRow add-in that allows you to limit maximum number of tab rows and show remaining tabs in a drop-down list similar to default Visual Studio behavior:
To use SingleRow you need to set tabs layout to Wrap and apply the following style changes:
<Style TargetType="TabsStudio:TabsHost" BasedOn="{StaticResource DefaultTabsHostStyle}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TabsStudio:TabsHost}"> <Grid> <Rectangle Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Fill="{TemplateBinding Background}"/> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <ContentPresenter Grid.Column="0"/> <TabsStudioSingleRow:HiddenTabs Grid.Column="1" TabsPanel="{TemplateBinding ContentControl.Content}"/> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}"> <Style.Triggers> <Trigger Property="TabsStudioSingleRow:Properties.IsTabHidden" Value="True"> <Setter Property="Visibility" Value="Collapsed"/> </Trigger> </Style.Triggers> </Style> <Style TargetType="TabsStudioSingleRow:HiddenTabs"> <Setter Property="Content" Value=">"/> <Setter Property="Margin" Value="2,0,2,0"/> <Setter Property="VerticalAlignment" Value="Center"/> <Style.Triggers> <Trigger Property="TabsStudioSingleRow:Properties.IsHiddenTabs" Value="False"> <Setter Property="Visibility" Value="Collapsed"/> </Trigger> </Style.Triggers> </Style>
This style adds the TabsStudioSingleRow:HiddenTabs button to open the drop-down list and binds it to the corresponding TabsPanel. SingleRow doesn’t actually hide tabs – it only sets the IsTabHidden property for them. The style above sets tab visibility based on this property. HiddenTabs button’s appearance is also defined in this style and the button is collapsed when there are no hidden tabs.
Tabs are hidden in the least recently used order and don’t automatically reappear even when space becomes available. Hidden tabs in the drop-down list are sorted alphabetically.
Default number of tab rows is 1, but you can change it in the SingleRow add-in options dialog:
Download link: SingleRow v1.0.0.
Wish it can limit the number of tabs too. When the limit reach it will automatically close the oldest tab.
Comment by Anonymous — August 25, 2012 @ 8:43 am