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 1958202
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T08:16:37+00:00 2026-05-17T08:16:37+00:00

I have a TabControl which looks like this: <TabControl> <TabItem> <TabItem.Header> <StackPanel Orientation=Horizontal> <Canvas

  • 0

I have a TabControl which looks like this:

<TabControl>
  <TabItem>
    <TabItem.Header>
      <StackPanel Orientation="Horizontal"> 
        <Canvas ... />
        <Label>Tab Number 1</Label>
      </StackPanel>
    </TabItem.Header>
  </TabItem>
 <TabItem>
    <TabItem.Header>
      <StackPanel Orientation="Horizontal">    
        <Canvas ... />
        <Label>Tab Number 2</Label>
      </StackPanel>
    </TabItem.Header>
  </TabItem>
</TabControl>

Ok, i like to have a different Text Color when the item is selected. I created a Style for that purpose:

<Style TargetType="{x:Type TabItem}">
      <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid Height="60">
                        <Border x:Name="Border" BorderBrush="#FFC6C7C8"
                             BorderThickness="1,0,1,0" Margin="-1,0,0,0">
                        </Border>
                        <Border x:Name="BorderOverlay" BorderBrush="Transparent"
                             BorderThickness="1,0,1,0" Margin="-1,0,0,0">
                            <ContentPresenter x:Name="ContentSite"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Center"
                               ContentSource="Header"
                               Margin="15,6,15,6">
                            </ContentPresenter>    
                        </Border>   
                  </Grid>
                  <ControlTemplate.Triggers>
                     <Trigger Property="IsSelected" Value="True">
                         <!-- What goes here? -->
                     </Trigger>
                  <ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
      </Setter>
</Style>

I tried by just setting Label.Foreground, but it doesn’t seem to work. I also tried it with a TextBlock, which did not worked as well.

I think this question is similar to mine, but the problem wasn’t solved in the end:
Setting TabItem foreground color also sets the TabControl foreground color

Thanks for any help.

  • 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-17T08:16:37+00:00Added an answer on May 17, 2026 at 8:16 am

    Try using Style Triggers instead of Control Template Triggers.

    Add this to your current style:

            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Foreground" Value="Green" />
                </Trigger>
                <Trigger Property="IsSelected" Value="False">
                    <Setter Property="Foreground" Value="Red" />
                </Trigger>
            </Style.Triggers>
    

    Here’s a generic style for everyone else.

                <Style TargetType="{x:Type TabItem}">
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="Green" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="False">
                            <Setter Property="Foreground" Value="Red" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have close button in the header of each tab of TabControl. Tabs are
I have a WPF TabControl with two TabItems. Each TabItem contains a ListBox with
I have a form that displays file information in a TabControl, and I'd like
I have a tab control with two tabs. Both tabs have controls which are
I have a form which has only tab control in it. I want to
My application has a static control which inside has a tab control. It looks
lets say i have a main form which have a lot of functionallity. this
I have a main object which has some properties and methods. This object can
I have a TabControl and each Tab can contain the same UI but with
I have a data bound tab control: <TabControl ItemsSource={Binding Products} Name=ProductsTabControl> <TabControl.ItemTemplate> <DataTemplate> <TextBlock

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.