Tabs Studio Blog (organizing Visual Studio document tabs)

June 11, 2011

Vertical scrollbar for the separate tabs window

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 9:53 am

When using the separate tabs window in stack mode, sometime you can open more tabs than fit in the docked window. One possible solution is to add a vertical scrollbar to scroll through the windows:

Tabs window with a vertical scrollbar

Tabs window with a vertical scrollbar


The following style adds ScrollViewer with vertical scroll bar visibility set to Auto, i.e. it is visible only when tabs don’t fit without scrolling:

<Style TargetType="TabsStudio:TabsHost" BasedOn="{StaticResource DefaultTabsHostStyle}">
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type TabsStudio:TabsHost}">
        <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                         VerticalScrollBarVisibility="Auto"
                         Focusable="False">
          <Grid>
            <Rectangle Width="{TemplateBinding Width}"
                       Height="{TemplateBinding Height}"
                       Fill="{TemplateBinding Background}"/>
            <ContentPresenter/>
          </Grid>
        </ScrollViewer>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

Blog at WordPress.com.