This project is read-only.

Cell background

Jun 16, 2009 at 4:42 PM

Hi, I'm new of the community (and of WPF DataGrid), so I apologize if the question is trivial.

I'm developing an application in which a grid shows a matrix of values (I'm using a DataView from a DataSet as ItemsSource for the DataGrid).

I'd like to show the user which cells he changed, highlighting them with a different background color (i.e. red vs default).

In the CellEditEnding event I'm doing

FrameworkElement element = e.Column.GetCellContent(e.Row);
((TextBox) element).Background = brush;

where brush is set depending on the new cell value.

The problem is that I cannot see any difference in the cell background, unless I set e.Cancel = true (where e is DataGridCellEditEndingEventArgs parameter).

Anyone can tell me where I'm making any mistake?

Thank you a lot