I have a ComboBox, bound to a list of objects. I can get the objects to fill the drop down just fine. I am trying to set the background color for each object in the items list of the dropdown. I can set any color for all of them easily in the below style code.
What I want to do is Bind the Background Color Value to the KeyColorValue field of my Key object.
Here is my XAML:
DisplayMemberPath="Name"
HorizontalAlignment="Left"
Margin="300,103,0,0"
VerticalAlignment="Top"
Width="186"
SelectionChanged="roleBoundSelector_SelectionChanged" >
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Background"
Value = "{Binding Path=KeyColorValue}" />
(If I put a color in here it works just fine…need to bind to the KeyColorValue of the MyKeys Object.)
Try this inside your style:
The DataContext of each ComboBoxItem is an object contained in the List that is feeding the ItemsSource of the ComboBox.
Let me know if this was of any help, regards!