Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:13:18+00:00 2026-05-26T02:13:18+00:00

I am trying to style some tabs but I ran into this issue where

  • 0

I am trying to style some tabs but I ran into this issue where the color of the border changes as I resize window. First of all, I used this http://blogs.intuidev.com/post/2010/01/25/TabControlStyling_PartOne.aspx to style the tabs if you’re wondering about the code.
Also, here is the pic of what’s wrong.enter image description here

EDIT:

    <Color x:Key="BorderColor_Base">#888</Color>

    <Color x:Key="TabControl_BackgroundColor_Base">#CCC</Color>

    <SolidColorBrush x:Key="TabControl_BackgroundBrush_Base" 
                   Color="{StaticResource TabControl_BackgroundColor_Base}"/>

    <LinearGradientBrush x:Key="TabItemPanel_BackgroundBrush" 
                       StartPoint="0,0" EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Offset="0.98" Color="Transparent"/>
            <GradientStop Offset="0.99" 
           Color="{StaticResource BorderColor_Base}"/>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="TabItem_BorderBrush_Selected" 
                   Color="{StaticResource BorderColor_Base}" />
<Style TargetType="{x:Type TabControl}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="TabControl">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="1*"/>
                        <RowDefinition Height="10*"/>
                    </Grid.RowDefinitions>
                    <Border Background="{StaticResource TabItemPanel_BackgroundBrush}" 
                     Padding="{StaticResource TabItemPanel_Padding}">
                        <TabPanel Grid.Row="0" IsItemsHost="True"/>
                    </Border>
                    <ContentPresenter Grid.Row="1" ContentSource="SelectedContent"/>

                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

<Style TargetType="{x:Type TabItem}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabItem}">
                <Grid>
                    <Border Name="Border"
                     Background="{StaticResource TabControl_BackgroundBrush_Base}"
                     BorderBrush="{StaticResource TabItem_BorderBrush_Selected}"
                     Margin="{StaticResource TabItemMargin_Selected}"
                     BorderThickness="2,1,1,1">
                        <!-- This is where the Content of the TabItem will be rendered. -->
                        <Viewbox>
                            <TextBlock x:Name="Header">
                                <ContentPresenter x:Name="ContentSite"
                                  ContentSource="Header"
                                   Margin="7,2,12,2"
                                  RecognizesAccessKey="True"/>
                            </TextBlock>
                        </Viewbox>
                    </Border>
                </Grid>


                <ControlTemplate.Triggers>
                    <Trigger Property="IsSelected" Value="False">
                        <Setter TargetName="Border" Property="Margin" Value="{StaticResource TabItemMargin_Base}" />
                        <Setter Property="Panel.ZIndex" Value="90" />
                    </Trigger>
                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="Panel.ZIndex" Value="100" />
                        <Setter TargetName="Border" Property="BorderThickness" Value="2,1,1,0" />
                        <Setter TargetName="Border" Property="Background" Value="White" />
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter TargetName="Header" Property="Background" Value="#CCC" />
                        <Setter TargetName="Header" Property="Foreground" Value="#888" />
                        <Setter Property="Panel.ZIndex" Value="80" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:13:18+00:00Added an answer on May 26, 2026 at 2:13 am

    The issue is with this brush:

    <LinearGradientBrush x:Key="TabItemPanel_BackgroundBrush" StartPoint="0,0" EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Offset="0.98" Color="Transparent" />
            <GradientStop Offset="0.99" Color="{StaticResource BorderColor_Base}" />
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>
    

    You are using a gradient from transparent to #888 as your background, so you are seeing one of the colors “in between” transparent and #888. Instead, you can use a Transparent background and border of #888, like so:

    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TabControl">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*" />
                            <RowDefinition Height="10*" />
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" Background="Transparent" BorderBrush="#888" BorderThickness="0,0,0,1" Padding="{StaticResource TabItemPanel_Padding}"
                                    SnapsToDevicePixels="True" />
                        <TabPanel Grid.Row="0" IsItemsHost="True" />
                        <ContentPresenter Grid.Row="1" ContentSource="SelectedContent" />
    
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    You may need to tweak the Margin of the Border and/or the TabPanel to ensure they line up correctly though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a preferences window. In it I have some checkbox style
Im currently trying to add some Style to my Hyperlinkbutton, but cannot get it
I'm trying to overwrite the style of some element of jquery ui, this is
I'm trying to do something like this. select :model, :attribute, :style => some:style; Add
I'm trying to style some Drupal output. In particular, I'm trying to reference a
I am trying to style hyperlinks: some must be white, and some others must
I'm trying to style up this heading. It slightly pops out the side with
I've been trying to use http://livepipe.net/control/tabs to get some javascript tabs up and running
I'm trying to style some buttons with CSS and my button container is an
I'm trying to dynamically style some elements on my pages. So, if I had

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.