C# – Why isnt the Background color working in a ComboBox

ccomboboxwpf

The only part of my Combo Box that isn't working is the Background Color. I want the whole thing to be yellow. But the collapsed part is still just gray.

<ComboBox Height="25" Width="125" Background="Yellow">
    <ComboBox.ItemContainerStyle>
        <Style TargetType="ComboBoxItem">
            <Setter Property="Background" Value="Yellow"/>
            <Setter Property="BorderBrush" Value="Yellow"/>
        </Style>
    </ComboBox.ItemContainerStyle>
    <ComboBoxItem Content="One"/>
    <ComboBoxItem Content="Two"/>
    <ComboBoxItem Content="Three"/>
</ComboBox>

Best Answer

Maybe this can help you :

<ComboBox Height="25" Width="125" Background="Yellow"
          Style="{StaticResource {x:Static ToolBar.ComboBoxStyleKey}}">
    <ComboBox.ItemContainerStyle>
        <Style TargetType="ComboBoxItem">
            <Setter Property="Background" Value="Yellow"/>
            <Setter Property="BorderBrush" Value="Yellow"/>
        </Style>
    </ComboBox.ItemContainerStyle>
    <ComboBoxItem Content="One"/>
    <ComboBoxItem Content="Two"/>
    <ComboBoxItem Content="Three"/>
</ComboBox>
Related Topic