WPF如何在选项卡项中获取选定的选项卡颜色

时间:2016-01-26 14:58:39

标签: c# wpf selected tabitem systemcolors

如何在tabitem中获取所选颜色?

enter image description here

我想用它来改变背景:

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

并尝试了所有可能性但没有得到正确的

enter image description here

1 个答案:

答案 0 :(得分:1)

试试这个:

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