title: ItemContainerStyle of TabItem is overriden by defalt Blue/white control colors in WPF Tabcontrol
body: <p>i have a Tabcontrol with Datatemplate for its TabItems and a ItemContainerStyle for the style of the TabItem.</p>
  
  <p>The TabControl:</p>
  
  <pre><code>&lt;TabControl Name="MainTabCtrl"  Margin="0" Padding="0" BorderThickness="0" Background="Transparent"
                          IsSynchronizedWithCurrentItem="True"
                          ItemsSource="{Binding Path=TabViewModels}" 
                          ItemTemplate="{StaticResource ClosableTabItemTemplate}"
                          HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                          ItemContainerStyle="{StaticResource ContainerStyle}"&gt;
  </code></pre>
  
  <p>The DataTemplate for the TabItems called ClosableTabItemTemplate:</p>
  
  <pre><code>&lt;DataTemplate x:Key="ClosableTabItemTemplate" &gt;
              &lt;Border BorderThickness="3" BorderBrush="Transparent" CornerRadius="4" &gt;
                  &lt;!--Border to make the tab item gap from the content--&gt;
                  &lt;Border x:Name="InsideBorder" BorderThickness="3" BorderBrush="#D6EAFF" CornerRadius="4"&gt;
                      &lt;!--Border for the rounded corners--&gt;
                      &lt;!--TabItem Content Grid--&gt;
                      &lt;Grid x:Name="tabItemGrid" ShowGridLines="True" Margin="0" Background="#D6EAFF"&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height="Auto"/&gt;
                          &lt;/Grid.RowDefinitions&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="25"/&gt;
                              &lt;!--Icon Column--&gt;
                              &lt;ColumnDefinition Width="1*"/&gt;
                              &lt;!--Title Column--&gt;
                              &lt;ColumnDefinition Width="20"/&gt;
                              &lt;!--Close Button Column--&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
  
                          &lt;!--Icon of tab Item--&gt;
                          &lt;Image Grid.Column="0" Grid.Row="1" Height="18" HorizontalAlignment="Left" Source="Images/tab1.jpg"/&gt;
  
                          &lt;!--Title of tab Item--&gt;
                          &lt;Label Name="TabText" Grid.Column="1" Grid.Row="1" Content="TabItem"  Height="23"  HorizontalAlignment="Left" 
                                             Margin="4,1,0,0"  VerticalAlignment="Top" FontFamily="Courier" FontSize="12" /&gt;
  
                          &lt;!--Close button of tab Item--&gt;
                          &lt;Button Style="{DynamicResource TabButton}"
                                              Name="button_close" Content="x"
                                              Command="{Binding Path=CloseCommand}"
                                              Grid.Column="2" Grid.Row="1" 
                                              Height="20" Width="20" 
                                              Margin="0,0,0,2" VerticalAlignment="Center" HorizontalAlignment="Right"
                                              FontFamily="Courier" FontStretch="Normal" FontWeight="Bold" FontSize="14" 
                                              Visibility="Visible" ToolTip="Close" 
                                              BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Padding="0,0,0,0"
                                              &gt;
                          &lt;/Button&gt;
                      &lt;/Grid&gt;
                  &lt;/Border&gt;
              &lt;/Border&gt;
  
  
              &lt;DataTemplate.Triggers&gt;
  
                  &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TabItem}},Path=IsSelected}" Value="True"&gt;
                      &lt;Setter TargetName="tabItemGrid" Property="Background" Value="#D6EAFF" /&gt;
                  &lt;/DataTrigger&gt;
  
                  &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TabItem}},Path=IsSelected}" Value="False"&gt;
                      &lt;!--&lt;Trigger Property="IsSelected"  Value="False"&gt;--&gt;
                      &lt;Setter TargetName="InsideBorder" Property="BorderBrush"&gt;
                          &lt;Setter.Value&gt;
                              &lt;LinearGradientBrush EndPoint="0,1" StartPoint="0,0"&gt;
                                  &lt;GradientStop Color="#FFCCCCD0" /&gt;
                                  &lt;GradientStop Color="#FF526593" Offset="1" /&gt;
                              &lt;/LinearGradientBrush&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                      &lt;Setter TargetName="tabItemGrid" Property="Background"&gt;
                          &lt;Setter.Value&gt;
                              &lt;LinearGradientBrush EndPoint="0,1" StartPoint="0,0"&gt;
                                  &lt;GradientStop Color="#FFCCCCD0" /&gt;
                                  &lt;GradientStop Color="#FF526593" Offset="1" /&gt;
                              &lt;/LinearGradientBrush&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                  &lt;/DataTrigger&gt;
                  &lt;!--&lt;/Trigger&gt;--&gt;
              &lt;/DataTemplate.Triggers&gt;
          &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>The ItemContainerStyle of the tabItem:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type TabItem}" x:Key="ContainerStyle"&gt;
              &lt;Setter Property="Background" Value="Red" /&gt;
              &lt;Setter Property="BorderBrush" Value="Red" /&gt;
              &lt;Setter Property="Padding" Value="0" /&gt;
              &lt;Setter Property="Margin" Value="0" /&gt;
              &lt;Style.Triggers&gt;
                  &lt;Trigger Property="IsEnabled" Value="false"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="IsEnabled" Value="true"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
  
                  &lt;Trigger Property="IsMouseOver" Value="false"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="IsMouseOver" Value="true"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
  
                  &lt;Trigger Property="IsFocused" Value="false"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="IsFocused" Value="true"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="IsKeyboardFocused" Value="false"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="IsKeyboardFocused" Value="true"&gt;
                      &lt;Setter Property="Background" Value="Red"/&gt;
                      &lt;Setter Property="BorderBrush" Value="Red" /&gt;
                  &lt;/Trigger&gt;
  
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
  </code></pre>
  
  <p>what happens is that the selected tab is always with white default control background no matter what i do:</p>
  
  <p><img src="https://i.stack.imgur.com/LDQ6G.jpg" alt="enter image description here"></p>
  
  <p>also when i point the mouse over the unselected tab it turns blue background instead of red:</p>
  
  <p><img src="https://i.stack.imgur.com/LumNi.jpg" alt="enter image description here"></p>
  
  <p>i use transparent color instead of red but it is easier to show the problem with the red color.</p>
  
  <p>why does the default colors override the itemStyleContainer and the style triggers?</p>