Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How change the background color of the dropdown panel of Combobox

I want to change the background color of the drowpdown panel of the combobox. I'm using WPF. I've read this post

BackgroundColor Items ComboBox WPF

and I've written this code:

      <ComboBox
        Width="{StaticResource UnityX3}"
        styles:Typhography.TypeSize="Body1"
        Margin="12 0 0 0"
        Foreground="{StaticResource Viola1Brush}"
        DisplayMemberPath="AuthorName"
        SelectedItem="{Binding Path=ConsoleViewModel.AnswersViewModel.SelectedAuthor}"
        ItemsSource="{Binding ConsoleViewModel.AnswersViewModel.Authors}"
        Grid.Column="1">
        <ComboBox.ItemContainerStyle>
          <Style TargetType="{x:Type ComboBoxItem}">
            <Setter Property="Background" Value="Blue" />
          </Style>
        </ComboBox.ItemContainerStyle>
      </ComboBox>

I have obtained the result in the picture.enter image description here

I want that the entire panel is blue, included the little border around the single item. How can I change my code in order to solve my problem? Thank you

like image 973
Martina Avatar asked Oct 18 '25 16:10

Martina


1 Answers

What you are seeing is a missing border color of the container. Set the BorderBrush value to the Blue for what is needed by the ItemContainerStyle to remove the White looking border.

like image 181
ΩmegaMan Avatar answered Oct 20 '25 10:10

ΩmegaMan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!