WPF: set background color in a combo box with high color contrast

111 Views Asked by At

So I ask the high contrast and set the background color to red:

private void HoherKontrast()
    {
        if (SystemParameters.HighContrast == true) 
        {     
            AKTIVES_ELEMENT_CONTRAST = Brushes.Red;
            NICHTAKTIVES_ELEMENT_CONTRAST = Brushes.Black;
        }
     }

If the text editor is in barrier-free mode, the background color is red:

 private void ComboboxGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
    {
        if (ChkBarrierefrei.IsChecked.Value == true)
        {
            ComboBox source = e.Source as ComboBox;
            if (source != null)
            {
                source.Background = AKTIVES_ELEMENT_CONTRAST;
            }
        }
    }

The problem: The background color does not turn red and the Combobox has a blue bar.

What do I have to do to make the combobox get the background color red?

0

There are 0 best solutions below