I have a binding with data validation implemented by IDataErrorInfo. When data validation fails, the property is set. How could I avoid the change of the property when data validation fails?
Thank you very much.
I have a binding with data validation implemented by IDataErrorInfo. When data validation fails,
Share
I don’t think
IDataErrorInfocan be used to avoid the property value change if value is not valid. It only helps binding proper error message to theUIso that the user can change given value to valid value.To avoid invalid values being set in your properties, if they are
CLR Properties, use validation methods in setters and if they areDependency Properties, use validation callback to properly validate the values.