Datagrid New Row Cell Validation - Validate Empty Text

Jun 1, 2010 at 3:19 AM

The problem is that if you never enter anything into a cell for a new row then that cell is never validated. This is a problem because I have columns that should not be null.

I am doing the check in the row level validation and storing the information about which cells are empty that should not be empty. The row level validation works fine and the row level validation error indicator goes on,(red exclamation mark at the beginning of the row) but I also need a visual indicator on the individual cells that are in error.

I am thinking that setting the HasError property for the cells that are in error should cause them to display n error style (the default red border). Is there a way to this this either from XAML (perferably) or from code?

Alternatively I could cause those cells to re-validate when the row editing is finished. Does anyone know how to do this?

Or any other solution?