Tabs Studio Blog (organizing Visual Studio document tabs)

September 2, 2009

Decorator add-in

Filed under: Uncategorized — Tags: , — Sergey Vlasov @ 7:14 pm

Decorator is an example of custom properties usage. It sets distinct color for tabs that belong to the project having the most opened tabs. I.e. if 2 opened tabs are for documents from Project1, 5 tabs from Project2 and 3 tabs from Project3, then tabs from Project2 will be colored blue.

TabsStudioDecorator.Properties class defines custom dependency property IsTopProjectProperty, registers it using the RegisterAttached method and provides two static set and get methods for it.

Main Decorator class recalculates the top project when a tab is created or destroyed. Then it sets IsTopProjectProperty to true for all tabs belonging to the top project (if number of tabs in the top project is greater than 3) and to false for the rest of tabs.

Main Decorator class also implements the TabsStudioExt.IStyler interface and returns definition for the TabsStudioDecorator namespace from the GetNamespacesForResourceDictionary method.

Following style is used to color top project tabs that are not currently selected to white-blue gradient:

<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
    <Style.Triggers>
        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="TabsStudioDecorator:Properties.IsTopProject" Value="True"/>
                <Condition Property="IsTabSelected" Value="False"/>
            </MultiTrigger.Conditions>
            <Setter Property="Background">
                <Setter.Value>
                     <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                         <GradientStop Color="#F5F5F5" Offset="0"/>
                         <GradientStop Color="#B0B0F0" Offset="1"/>
                     </LinearGradientBrush>
                </Setter.Value>
            </Setter>  
        </MultiTrigger>
    </Style.Triggers>
</Style>
Four tabs belonging to WebSite2 project are colored blue

Four tabs belonging to WebSite2 project are colored blue

Download Decorator v1.0.0 for Tabs Studio v1.5.7.

3 Comments

  1. I see different Add-In that can be downloaded… sorter, decorator, etc. but there is no information on how to install the files. I download the zip file and extract the files. Then what do I do ?

    Comment by Rich — September 9, 2009 @ 7:36 pm

  2. […] Filed under: Uncategorized — Tags: Add-ins — Sergey Vlasov @ 8:48 pm Decorator add-in v1.0.0 was found guilty in disrupting Visual Studio operations, even causing a crash. It too often looked […]

    Pingback by Decorator update « Tabs Studio Blog (engineering the Visual Studio add-in) — February 7, 2010 @ 8:48 pm


RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Blog at WordPress.com.