How to change foreground color on selected tabitem?

Takeshi 41 Reputation points
2023-03-09T21:49:11.74+00:00

Hi all,

I have styled everything but foreground of selected file ... it doesnt work ... can you help me, PLEASE?

so my code ...

App.xaml

<Style TargetType="{x:Type TabItem}" x:Key="TabItemStyle">
    <Setter Property="Background" Value="#1d4f73" />
    <Setter Property="Foreground" Value="#fff" />
    <Setter Property="Padding" Value="20,10" />
    <Setter Property="FontSize" Value="14" />
    <Style.Triggers>
        <Trigger Property="IsSelected" Value="True">
            <Setter Property="Foreground" Value="#000" /> ... this doesnt work
        </Trigger>
    </Style.Triggers>
</Style>

SomePage.xaml

<TabControl BorderThickness="0,3,0,0" FontSize="18">
    <TabItem Name="name" Header="SomeHeader" Style="{StaticResource TabItemStyle}">
    </TabItem>        
</TabControl>
Developer technologies | C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.