.net - Performing validation on a databound object after the property has been updated -
i have basic form controls databound object implementing inotifypropertychanged interface. add validation couple of properties dont want go through implementing idataerrorinfo sake of validating couple of properties.
i have created functions perform validation , return error message (if applicable) in object. call these functions form when relevant properties on object have changed, , setup errorprovider control in form error messages have been returned validation functions.
i have tried hooking event handlers validating , lostfocus events, these seem fire before object updated, , hence not validating correct data. when leave textbox, go in , leave again validation runs against correct data.
is there event can hook can call these validation functions after property on object has been updated? or better off implementing idataerrorinfo interface?
i'm not sure problem is, saying can't property set until control loses focus?
if so, need set binding update onpropertychanged
instead of onvalidation
.
binding onpropertychanged
means binding updated immediately, while onvalidation
updates underlying object when validation triggered (which controls when lose focus).
Comments
Post a Comment