Tabs Studio Blog (organizing Visual Studio document tabs)

May 18, 2009

Document and non document tabs

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 3:43 pm

One way to differentiate tabs is by document/non document property. Document tabs are source files, designers and resources. Non document tabs are Start Page, Class View, Object Browser etc. I’ve added IsDocument property to all tab controls reflecting this dichotomy. Default style doesn’t use this property.

Custom style that sets different color for non document tabs should also take into account conditions when non document tab is selected and when non document tab was previously selected. It is possible to set different color for each case. It is also possible to use custom color for non document tab only if it is not selected and was not previously selected, as demonstrated in the following example:

<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
    <Style.Triggers>
        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="IsDocument" Value="False"/>
                <Condition Property="IsTabSelected" Value="False"/>
                <Condition Property="IsPreviouslySelectedTab" Value="False"/>
            </MultiTrigger.Conditions>
            <Setter Property="Background">
                <Setter.Value>
                     <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                         <GradientStop Color="#F5F5F5" Offset="0"/>
                         <GradientStop Color="#B0D0B0" Offset="1"/>
                     </LinearGradientBrush>
                </Setter.Value>
            </Setter>  
        </MultiTrigger>
    </Style.Triggers>
</Style>
Custom color for non document tab

Custom color for non document tab

Blog at WordPress.com.

%d bloggers like this: