Tabs Studio Blog (organizing Visual Studio document tabs)

May 3, 2009

Close tab button

Filed under: Uncategorized — Sergey Vlasov @ 11:40 am

I’ve added close tab button to tabs with default style that displays it only for the selected tab:

Close tab button on the selected tab

Close tab button on the selected tab

You can customize it with style to show close tab button on all tabs:

<Style TargetType="TabsStudio:CloseTabButton" BasedOn="{StaticResource DefaultCloseTabButtonStyle}">
    <Style.Triggers>
        <Trigger Property="IsTabSelected" Value="False">
            <Setter Property="Visibility" Value="Visible"/>
        </Trigger>
    </Style.Triggers>
</Style>
Close tab button on all tabs

Close tab button on all tabs

Of course, you can hide close tab button from all tabs if you like:

<Style TargetType="TabsStudio:CloseTabButton" BasedOn="{StaticResource DefaultCloseTabButtonStyle}">
    <Setter Property="Visibility" Value="Collapsed"/>
</Style>

Another interesting customization is ability to increase close tab button size. For example, if you use larger font size for tabs:

<Style TargetType="TabPanel" BasedOn="{StaticResource DefaultTabPanelStyle}">
    <Setter Property="Control.FontSize" Value="12pt"/>
</Style>
<Style TargetType="TabsStudio:CloseTabButton" BasedOn="{StaticResource DefaultCloseTabButtonStyle}">
    <Setter Property="LayoutTransform">
        <Setter.Value>
            <ScaleTransform ScaleX="1.00" ScaleY="1.00" />
        </Setter.Value>
    </Setter>
</Style>

Larger font size and larger close tab button

Larger font size and larger close tab button


(Default ScaleX and ScaleY for close tab button is 0.75)

Blog at WordPress.com.