Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1655
setting background color to tabitemEx when it is selected
posted

I am trying to set the background color to a tabItemEx when it is selected or MouseOver using below style.

<Style x:Key="tabTabItem" TargetType="{x:Type TabItem}">
        <Setter Property="Background" Value="#FFE1E1E1" >
          
        </Setter>
       
        <Setter Property="Foreground" Value="#FF000000"></Setter>
        <Setter Property="Margin" Value="2,0,2,0"></Setter>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
       
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="#FFFFFFFF"></Setter>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">              
               <Setter Property="Foreground" Value="#FFFFFFFF"></Setter>
               <Setter Property="FontFamily" Value="Arial"/>
                <Setter Property="Background">
                   <Setter.Value>
                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                       <GradientStop Color="#FFB14D71" Offset="0.125"/>
                       <GradientStop Color="#FF913E5C" Offset="0.789"/>
                    </LinearGradientBrush>
                   </Setter.Value>

But it is not setting any color. it is displaying default color only.

Am i doing ny thing wrong? Please suggest me the correct way.

 


                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

Parents
No Data
Reply
  • 69686
    posted

    Hello,

    Actually, the style has to target the TabItemEx rather than the TabItem element, like this:

    <Style TargetType="{x:Type igWindows:TabItemEx}">

    and it should be working.

Children