Note that there are some explanatory texts on larger screens.

plurals
  1. POXAML Trigger WPF Tab selection changes more than the tab header
    text
    copied!<p>I have a trigger that when a tab is selected I color the tab blue and the text white, but the problem is that this trigger, for some reason, also changes the text color in the tabheader body to white as well in the group boxes. It seems that anything that has a header turns to white. </p> <p>How do I make it so only the header in the tab itself </p> <pre><code>&lt;TabItem Header="Query Editor" &lt;-- This text only </code></pre> <p>will change to white when selected and no other text on the form?</p> <p>Below is the code I am using.</p> <p>Thanks.</p> <pre><code>&lt;Style TargetType="{x:Type TabItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type TabItem}"&gt; &lt;Grid&gt; &lt;Border Name="Border" Background="WhiteSmoke" BorderBrush="Black" BorderThickness="1,1,1,1" CornerRadius="6,6,0,0"&gt; &lt;ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="12,2,12,2"/&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="IsSelected" Value="True"&gt; &lt;Setter TargetName="Border" Property="Background" Value="#00396a" /&gt; &lt;Setter Property="Foreground" Value="White" /&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsSelected" Value="False"&gt; &lt;Setter TargetName="Border" Property="Background" Value="WhiteSmoke" /&gt; &lt;Setter Property="Foreground" Value="Black" /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload