Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1830
Detecting IDataErrorInfo Validation Errors
posted

I'm using xamDataGrid, and I want to be able to detect validation errors (esp. row-level) to enable/disable other controls on the window.  I'm aware of the DataRecord.HasError property, but I'm apparently only able to detect that as being true in the EditModeEnded and RecordUpdating events fired just after the error for the record involved.  When I move to another row, and iterate the grid DataRecords, in EditModeStarting for instance, the error for that previous record has been removed, though the error icon remains.  I've been able to disallow editing another cell by setting a cancel action in the previous record's RecordUpdating event (oddly, this is not default behavior).

That said, this brings up the overall questions: why does the error icon remain after the DataError is removed when I don't use RecordUpdating event cancellation?  What is wrong with my approach to detecting grid errors?  Must I in fact use the cancellation in RecordUpdating to retain the DataError, to be detectable outside the grid (e.g. disabling a save button), as well as disabling edit of another record in the same question?  Maybe I've answered my own question :)