IDataErrorInfo

Developer
Jul 11, 2011 at 9:04 PM

Objo,

Have you used the property editor on an object that implements the IDataErrorInfo interface? I see that there is code in the library to handle it, but no matter what I do I get the red border around the textboxes in the property editor at all times.

Regards,

Per

Coordinator
Jul 13, 2011 at 1:08 AM

Hi Per! see the PersonViewModel in Examples/PropertyEditor/ViewModelDemo. Try to set Name to empty or Age<0. Seems to work there. Let us know if there is a bug!

Developer
Jul 13, 2011 at 7:27 PM
Edited Jul 13, 2011 at 7:27 PM

That example works...but after some thought, that is not what I need.

 

Regular bindings allow for throwing an error in the set-method of a property, such as a ArgumentOutOfRangeException, and if ValidateOnDataErrors is true in the binding, the textbox will be marked with a red border. What I need is to prevent the erroneous value from ever being set in my model (that's why I throw the exception) and at the same time indicating the error with the red border. Do you have a good idea on how to accomplish this behavior using PropertyTools?