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
Use DataErrorIcon to Display Errors From Service Layer
posted

I'd like to use the IDataErrorInfo, record-level, validation error icon to display errors returned from service calls which I make in the RecordUpdating event.  This icon is normally associated with IDataErrorInfo support, but I cannot make the service calls via that support (i.e., IDataErrorInfo.Error getter) because that property getter is accessed much too frequently in XDG.  For now, I've had to settle with displaying a MessageBox from RecordUpdating.  It would be nice for the service errors to appear integrated with the built-in validation support.

This might not be possible, as it depends on how record-level IDataErrorInfo validation is implemented in XDG.  One approach that works outside of XDG uses an hidden BindingExpression associated with the DataErrorValidationRule for a BindingGroup, and marks the BindingExpression as invalid, which forces the error message to display in the group's error icon.  This is necessary because the error icon is bound to the group's Validation.Errors.  This is but one idea, and it may be possible to do something like this in XDG, but it depends on how IDataErrorInfo validation is implemented in XDG.

I originally posted this question several months ago and have not received an answer.  I'd like another analyst to try and help.  Please do not refer me to the documentation on IDataErrorInfo, as I'm already quite familiar with it.  I've also examined the relevant templates and nothing came to light.  Serious help is appreciated.