Loop through all cells in Xceed DataGrid for WPF?
- by ewall
I am changing the background color of the cells when the user has made an edit. I would like to return all cells to normal colors when the changes are saved (or reverted).
It's easy enough to set the cell's original background color (as stored in the parent row). But I can't figure out how to loop through all the cells in the table to reset them.
I found an article in the Xceed Knowledge Base called "How to iterate through the grid's rows"... which you would think would be perfect, right? Wrong; the properties (or methods) like .DataRows, .FixedHeaderRows, etc. mentioned in the article are from an older/defunct Xceed product.
This forum thread recommends using the DataGrid's .Items property, which in my case returns a collection of System.Data.DataRowViews... but I can't find any way to cast that (or any of its related elements) up to the Xceed.Wpf.DataGrid.DataCells I need to change the background color.
In short, how do I loop through the rows and cells so I can reset the background property?