title: How to programmatically change selected tabItem Header colour from code behind
body: <p>I have a program in which I have to load colours at startup.
  Then I have to add a tabcontrol with tab items:</p>
  
  <pre><code>TabControl tabc = m_Executer.GetTabControl();&lt;---- from outside
  if (tabc != null)
  {
      TabItem tbi = new TabItem();
      tbi.Header.Background = Brushes.Transparent;
      tbi.Header.Content = "End manager";
      tabc.Items.Add(tbi);
      tabc.SelectionChanged += (sender2, args) =&gt;
      {
          ((TabItem)(tabc.SelectedItem)).Background = Brushes.Red;
          tabc.UpdateLayout();
      };
  }
  </code></pre>
  
  <p>the idea is changing the background when the selectionchanged event is fired but that doesn't work.</p>