Search code examples
c#wpfselectedtabitemsystemcolors

WPF how to get selected tab colour in a tab item


How can I get the selected colour in a tabitem?

enter image description here

I want to use it to change the background:

t.Background = new SolidColorBrush(SystemColors.WindowColor);

and have tried all possibilities but didn't get the right one

enter image description here


Solution

  • Try this:

    Brush brsTabSelected = default(Brush);
    private void WindowViewBase_Loaded(object sender, RoutedEventArgs e)
    {
      tabItem1.IsSelected = true;
      brsTabSelected = tabItem1.Background;
    }