Tabs Studio Blog (organizing Visual Studio document tabs)

August 26, 2010

ASP.NET MVC tabs grouping and coloring

Filed under: Uncategorized — Tags: , — Sergey Vlasov @ 1:29 pm

I’ve created the MvcGroup add-in that groups ASP.NET MVC controller and view tabs near each other (a controller is placed before views). This add-in also adds IsController, IsView and GroupName properties that can be used to color MVC tabs by type and/or by group name. See the following two examples:

<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
  <Style.Triggers>
    <MultiTrigger>
      <MultiTrigger.Conditions>
        <Condition Property="TabsStudioMvcGroup:Properties.IsController" 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="#B0D0B0" Offset="1"/>
          </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    </MultiTrigger>
    <MultiTrigger>
      <MultiTrigger.Conditions>
        <Condition Property="TabsStudioMvcGroup:Properties.IsView" 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="#B0B0D0" Offset="1"/>
          </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    </MultiTrigger>
  </Style.Triggers>
</Style>
ASP.NET MVC tabs grouping and coloring by type

ASP.NET MVC tabs grouping and coloring by type

<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
  <Style.Triggers>
    <MultiTrigger>
      <MultiTrigger.Conditions>
        <Condition Property="TabsStudioMvcGroup:Properties.GroupName" Value="Account"/>
        <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="#B0D0B0" Offset="1"/>
          </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    </MultiTrigger>
    <MultiTrigger>
      <MultiTrigger.Conditions>
        <Condition Property="TabsStudioMvcGroup:Properties.GroupName" Value="Home"/>
        <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="#B0B0D0" Offset="1"/>
          </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    </MultiTrigger>
  </Style.Triggers>
</Style>
ASP.NET MVC tabs grouping and coloring by group name

ASP.NET MVC tabs grouping and coloring by group name

Download link: MvcGroup v1.0.0.

August 20, 2010

Per project tab coloring

Filed under: Uncategorized — Tags: , — Sergey Vlasov @ 8:52 am

As the Decorator add-in demonstrated, it is easy to add project properties to tabs and use it for coloring. I decided to write the separate Projector add-in that explicitly adds the project name property to tabs.

With the Projector installed, to color tabs for the ClassLibrary2 project with purple you can use the following style:

<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
    <Style.Triggers>
        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="TabsStudioProjector:Properties.ProjectName" Value="ClassLibrary2"/>
                <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>
Purple tab from the ClassLibrary2 project

Purple tab from the ClassLibrary2 project

Finding and assigning a distinct color for each project in a solution could be hard. Assigning a single color to a group of projects is more practical, except WPF doesn’t have direct capability to trigger match between a project name and a list of names. Projector adds custom IsAnyOfConverter inherited from System.Windows.Data.IValueConverter to support this scenario. The custom Convert function of the converter receives tab’s project name as the value parameter, comma separated list of project names for a color as the parameter parameter and returns true if tab’s project name is in the list:

public object Convert(object value, System.Type targetType,
    object parameter, System.Globalization.CultureInfo culture)
{
    string[] allowedValues = ((string)parameter).Split(new System.Char[] { ',' });
    return ((System.Collections.Generic.IList)allowedValues).Contains((string)value);
}

To use this converter in XAML we define it as a static resource and invoke in a data trigger:

<TabsStudioProjector:IsAnyOfConverter x:Key="IsAnyOf" />

<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding Path=(TabsStudioProjector:Properties.ProjectName),
                        RelativeSource={RelativeSource Self},
                        Converter={StaticResource IsAnyOf},
                        ConverterParameter='ClassLibrary3,ClassLibrary4'}"
                        Value="True"/>
                <Condition Binding="{Binding Path=IsTabSelected, RelativeSource={RelativeSource Self}}" Value="False"/>
            </MultiDataTrigger.Conditions>
            <Setter Property="Background">
                <Setter.Value>
                     <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                         <GradientStop Color="#F5F5F5" Offset="0"/>
                         <GradientStop Color="#A0C0A0" Offset="1"/>
                     </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </MultiDataTrigger>
    </Style.Triggers>
</Style>
Green tabs from the ClassLibrary3 and ClassLibrary4 projects

Green tabs from the ClassLibrary3 and ClassLibrary4 projects

Using the same technique it is possible, for example, to create a regex converter matching tab’s project name with a regular expression specified as the parameter.

Download link: Projector v1.0.

May 8, 2010

Styling tabs in a separate window

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

In Visual Studio 2010 default style for tabs uses left and right margins of 1 pixel:

<Style x:Key="DefaultTabsStyle" TargetType="TabsStudio:Tabs">
  <Setter Property="Margin" Value="1,0,1,0"/>
</Style>

It makes transition between Tabs Studio tabs and Visual Studio border under the tabs in the left and right corners smooth:

Left tab margin

Left tab margin


When tabs are in a separate window, default margins create white lines to the left and to the right of the tabs:
White lines to the left and to the right of the tabs

White lines to the left and to the right of the tabs


Setting margins to 0 removes these lines:

<Style TargetType="TabsStudio:Tabs" BasedOn="{StaticResource DefaultTabsStyle}">
  <Setter Property="Margin" Value="0,0,0,0"/>
</Style>

Excessive tabs margins removed

Excessive tabs margins removed

Another useful customization for tabs in a separate window is tabs background. The default background in VS 2010 style is transparent, it results in dark blue for normal tabs placement and white for tabs in a separate window. As an example, the following style sets tabs background to dark blue:

<Style TargetType="TabsStudio:Tabs" BasedOn="{StaticResource DefaultTabsStyle}">
  <Setter Property="Background" Value="#293955"/>
</Style>

Dark blue tabs background

Dark blue tabs background


A similar style can be used to customize tabs background in VS 2008, which is by default grey control brush.

April 13, 2010

Updated Visual Studio 2010 tab style

Filed under: Uncategorized — Tags: , — Sergey Vlasov @ 11:38 am

I’ve changed selected tab colors to match the default VS 2010 theme – yellow for active, dark blue for inactive and grey for unfocused:

Active and inactive tabs

Active and inactive tabs


Unfocused tabs

Unfocused tabs

April 12, 2010

Close file buttons

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 10:41 pm

I’ve added the close file button to each extension. It should be particularly useful in SSMS where you more often need to close a file rather than a whole tab:

Close file buttons in SSMS

Close file buttons in SSMS


In the default style these buttons are collapsed, but you can use all usual properties in a custom style to make them visible. For example, the following style makes close file buttons visible on the selected tab and hides the close tab button in a tab when it contains more than a one extension:

<Style TargetType="TabsStudio:TabExtensionCloseButton" BasedOn="{StaticResource DefaultTabExtensionCloseButton}">
  <Style.Triggers>
    <Trigger Property="IsTabSelected" Value="True">
      <Setter Property="Visibility" Value="Visible"/>
    </Trigger>
  </Style.Triggers>
</Style>

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

January 23, 2010

Visual Studio 2010 Silver theme

Filed under: Uncategorized — Tags: , — Sergey Vlasov @ 3:24 pm

This month Matthew Johnson released the Visual Studio Color Theme Editor extension for Visual Studio 2010. This extension allows users to customize colors used by Visual Studio 2010 and contains three example themes (Autumn, Emerald and Silver):

Default Visual Studio 2010 theme

Default Visual Studio 2010 theme


Visual Studio 2010 Silver theme

Visual Studio 2010 Silver theme


Jameel Al-Aziz, in addition to his Tabs Studio 2010 style, has created Tabs Studio 2010 Silver theme style:
Tabs Studio 2010 Silver theme style

Tabs Studio 2010 Silver theme style


Get Tabs Studio 2010 Silver theme style by Jameel Al-Aziz (Visual Studio 2010 Beta 2 and Tabs Studio v1.7.6 or greater required).

November 24, 2009

Tabs Studio 2010 style by Jameel Al-Aziz

Filed under: Uncategorized — Tags: , — Sergey Vlasov @ 5:45 pm

Jameel did a great work designing Tabs Studio style perfectly matching Visual Studio 2010 theme:

Visual Studio 2010 style by Jameel Al-Aziz

Visual Studio 2010 style by Jameel Al-Aziz


His style requires Visual Studio 2010 Beta 2 and Tabs Studio v1.7.6. You can get this style here.

November 10, 2009

Animation effects

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 9:05 pm

You can use WPF animation effects to customize Tabs Studio presentation. Tabs Studio v1.7.3 demonstrates fade effect for the yellow extension background when mouse is over it and transition effect between states for the close tab button. You can turn on these two effects in the Quick Style window:

Quick Style animate option

Quick Style animate option


For example, fade-in effect for an extension starts on mouse enter event, during 0.2 seconds it changes border color from transparent to gray and it changes yellow background from transparent to opaque:

<EventTrigger RoutedEvent="Control.MouseEnter">
  <EventTrigger.Actions>
    <BeginStoryboard>
      <Storyboard>
        <ColorAnimation  Duration="0:0:0.2" Storyboard.TargetName="Border"    Storyboard.TargetProperty="BorderBrush.Color"  To="Gray"/>
        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="LabelText" Storyboard.TargetProperty="Background.Opacity" To="1"/>
      </Storyboard>
    </BeginStoryboard>
  </EventTrigger.Actions>
</EventTrigger>

Full sample effects definitions are available when you turn on animation and generate style in the Quick Style window. I think the most common customization for the sample effects provided will be adjustment of animation duration.

October 27, 2009

Updated tab extension style

Filed under: Uncategorized — Tags: — Sergey Vlasov @ 5:29 pm

I’ve updated default TabExtension style to ease extension selection. When mouse is over extension it is highlighted with yellow background now, there is no more shadow for extension and there is more padding around tab extension and tab name:

Updated tab extension style

Updated tab extension style

October 23, 2009

Improved text rendering in .NET 4.0 Beta 2

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

WPF 4.0 introduces new text rendering options. You can customize Tabs Studio text with these new options in Visual Studio 2010 Beta 2 using a style like this one:

<Style TargetType="TabsStudio:Tabs" BasedOn="{StaticResource DefaultTabsStyle}">
    <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
    <Setter Property="TextOptions.TextRenderingMode" Value="Aliased"/>
</Style>

Text with display aliased options

Text with display aliased options


Text with display aliased options 3x zoom

Text with display aliased options 3x zoom


It would be great to make sharper text works in Visual Studio 2008 as well, but right now I don’t see a good solution. Simply installing .NET 4.0 Beta 2 runtime on a Visual Studio 2008 machine doesn’t make these new options available to Tabs Studio automatically.

Older Posts »

Blog at WordPress.com.