The
Background
property will just change the edit and drop arrow area of a WPF
Combobox
.
To change other colors like popup background and highlight color, you have to add some brushes to the resource dictionary, mapping to the system colors:
var combo = new Combobox();
combo.Background = Brushes.Yellow;
combo.Foreground = Brushes.Blue;
combo.Resources.Add(SystemColors.WindowBrushKey, Brushes.Yellow);
combo.Resources.Add(SystemColors.HighlightBrushKey, Brushes.Red);
This is equivalent to XAML code:
<Combobox Background="Yellow" Foreground="Blue">
<Combobox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="Yellow" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Red" />
</Combobox.Resources>
</Combobox>