Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isnt my Background color working in a ComboBox

Tags:

c#

combobox

wpf

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>
like image 984
Jim Michaels Avatar asked Jan 05 '23 12:01

Jim Michaels


1 Answers

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>
like image 163
A.Pissicat Avatar answered Jan 08 '23 03:01

A.Pissicat