I have looked through all the answers provided on this website for an answer to my problem and I couldn’t find a working solution.
I have a combobox that is bound to a Class using the ItemsSource Property.
The Class Definition is as follows:
public class DataSource
{
public string DisplayField { get; set; }
public string ValueField { get; set; }
}
The ComboBox is bound to display the data using the DisplayMemberPath = “DisplayField” and the SelectedValuePath = “ValueField”… This is done in the code behind and loaded when the Window Loads.
The ComboBox is defined as follows:
<ComboBox Grid.Row="0" Grid.Column="1" Margin="5 5 5 0" Name="releaseHoldDropDown" Width="100"/>
I need a way to change the background to Green and the Foreground to White if the value of the drop down changes to “Release”.
I also need to change the background to Red and the Foreground to White if the value of the drop down changes to “Hold”.
FYI: I am using the ExpressionLight.xaml theme to style the application as a whole.
As a side note I also want a way to change the background on ALL my Comboboxes from the Grey to White to make them more readable. So I need to modify the ExpressionLight.xaml but I have no idea which part to edit to make those changes.
Any Help Will be Appreciated.
thank you
why not use a style.trigger?
this could be a start for you