Loop through all cells in Xceed DataGrid for WPF?

Posted by ewall on Stack Overflow See other posts from Stack Overflow or by ewall
Published on 2010-01-21T15:51:32Z Indexed on 2010/04/18 3:53 UTC
Read the original article Hit count: 565

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about xceed-datagrid

Related posts about wpf