I am looking for a way to change the color of the content of the entire combobox item, not just the text as in the image below:
I am trying to achieve something like this:
The code I have so far and what I was able to find on the internet:
<ComboBox
ItemsSource="{Binding Items}"
Height="49" Width="84">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" Background="Red"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
You can set it by ItemContainerStyle to like this:
<ComboBox
ItemsSource="{Binding Items}"
Height="49" Width="84"
DisplayMemberPath="Name">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="Red" />
<Setter Property="BorderBrush" Value="Red" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
Do you wanna have border around every ComboBoxItem? You can set BorderBrush to Red too. Or hide it by BorderThickness to set it to "0"
<Setter Property="BorderThickness" Value="0" />
Hopefully this will help you.