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
60
XamDateTimeEditor - OnEditModeValidationError - Forcing value into editor
posted

Normal 0 21 false false false NO-BOK X-NONE X-NONE MicrosoftInternetExplorer4

HI,

I inherit the XamDateTimeEditor and on the OnEditModeValidationError I want to put a value (based on different criteria) into the editor.

This work well using:

   this.Value = <my computed datetime value>
   args.Handled = true;
   args.InvalidValueBehavior = InvalidValueBehavior.RetainValue;
               
However the focus is still in the datetime editor (ie. don't moves to the next control). If I don't set the args.InvalidValueBehavior an error message is displayed.

Is there any way I can make the XamDateTimeEditor behave like it had (and in fact have) a valid value and loose focus (as it would normally do)?

Thanks

 

 

  • 54937
    Verified Answer
    Offline posted

    The only InvalidValueBehavior that does not keep focus is the RevertValue option. However that will reset the Value back to the OriginalValue so what you probably want to do is use RevertValue but after you set the Value, call the InitializeOriginalValueFromValue method so the value remains what you set it to.