Hi I got a DatagridView and I would like it to change background color depending on the data in each row.
Ex.
| Person 1 | Person 2 | Person 3 |
|—-100—-|—200—–|—–150—-|
|—-300—-|—100—–|——50—-|
In the first row I would like it to make “100” have a red background color and “200” green.
Or. The lowest value = red highest = green
Now the thing is that Im using a BindingList for my data, and its being updated async with INotifyPropertyChanged. So I need some way of checking each time one of the values has been updated.
Do the DataGridView have any event that would be usefull?
Subclass DataGridView and override OnCellFormating(), in here you can inspect the cell value and set the colours appropriately.
In regard to comments below about using the corresponding event, yes you can do that but the virtual method has better performance and subclassing DataGridView encapsulates all the behavior of your grid in one place.