Как установить цвет фона, который выбран, WPF? - PullRequest
0 голосов
/ 25 ноября 2018

Как установить выбранный цвет фона таблицы?Цвет текста меняется, фон не меняется:

Sub changebackgroundcolorwhenselected(ByVal tabitem1 As TabItem)
    tabitem1.Background = Brushes.DeepSkyBlue
    tabitem1.Header = "House"
    Dim tr As New Trigger()
    tr.Property = TabItem.IsSelectedProperty
    tr.Value = True
    Dim h As New Setter(TabItem.BackgroundProperty, Brushes.Red) '?
    tr.Setters.Add(h)
    Dim h2 As New Setter(TabItem.ForegroundProperty, Brushes.Green)
    tr.Setters.Add(h2)
    Dim x As New Style
    x.Triggers.Add(tr)
    tabitem1.Style = x
End Sub
...