Reputation: 3222
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.
Upvotes: 1
Views: 132
Reputation: 30840
I don't think IDataErrorInfo
can be used to avoid the property value change if value is not valid. It only helps binding proper error message to the UI
so 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 are Dependency Properties
, use validation callback to properly validate the values.
Upvotes: 1