1

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

Luca
  • 918
  • 2
  • 13
  • 30
  • Take a look on [WPF TabControl, change the background color of the TabItem with C# codes](http://stackoverflow.com/questions/20555505/wpf-tabcontrol-change-the-background-color-of-the-tabitem-with-c-sharp-codes), I think it will help. – Athafoud Jan 26 '16 at 15:07
  • I am not clear at what has this got to do with my problem: here it says how to set tab colour with some predefined colours. Instead I want to know what is the predefined tab colour. – Luca Jan 26 '16 at 15:36

1 Answers1

1

Try this:

Brush brsTabSelected = default(Brush);
private void WindowViewBase_Loaded(object sender, RoutedEventArgs e)
{
  tabItem1.IsSelected = true;
  brsTabSelected = tabItem1.Background;
}
Patrick
  • 3,073
  • 2
  • 22
  • 60