c# - WPF: Change background on some combobox items -


I am trying to change the background of some objects in a combobox which

  & Lt; ComboBox ItemsSource = "{Binding Path = Model.Names, Mode = Oneway}" SelectedValue = "{Binding Path = SelectedCompanyName}" DisplayMemberPath = "aka" />  

This is that "aka" is saved in two different places (in company and in order) and if they do not match then we want to highlight it.

I want to do something like this:

  & lt; Style & gt; ... & lt; DataTrigger binding = "{binding path = isMismatch}" value = "this is true & gt; SETOR property =" background "Any help is appreciated.   

<

& Lt; ComboBox width = "300" height = "30" itemsSource = "{binding path = Model.Names, Mode = Oneway}" & gt; & Lt; ComboBox.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Grid x: name = "templateGrid" & gt; & Lt; Text box text = "{name of binding}" /> & Lt; / Grid & gt; & Lt; DataTemplate.Triggers & gt; & Lt; DataTrigger binding = "{isMismatch binding}" value = "true" & gt; & Lt; Setter target name = "templateGrid" property = "background" value = "red" /> & Lt; / DataTrigger & gt; & Lt; /DataTemplate.Triggers> & Lt; / DataTemplate & gt; & Lt; /ComboBox.ItemTemplate> & Lt; / ComboBox & gt;

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -