I have a DataGrid control in a WPF application. I want to be able to at runtime, select a value from a combo box, click a button and highlight the background color of all rows that meet this condition within the DataGrid. This was pretty easy to do in Windows Forms in the code behind, but I can not figure it out in WPF.
Any help gratefully received.
Thank you
Hello I created a sample which solves this by using triggers and a valueconverter.
Basically, I have a trigger on the gridcell, which is bound to the selecteditem of the combo-box. When you change selection, the trigger fires, and the cell uses the valueconverter to see if the selecteditem is the same as the value of the grid cell.
MainWindow.xaml
MainWindow code behind file
NameValueConverter
ViewModel