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
435
XamNumericInput.ValueConstraint.Nullable not being honoured
posted

Hi Infragistics,

We have a XamNumericInput control with a ValueConstraint that is not nullable...

<ig:ValueConstraint ValidateAsType="Integer32" MinInclusive="1000" MaxInclusive="2000" Nullable="False"/>

Expected behaviour in this state (as per the documentation) is that the contents of the control (in edit mode) cannot be cleared.

That doesn't appear to be the case. Setting Nullable to False still allows the control to be cleared. We've replicated this behaviour on both a XamNumericInput and XamDateInput. I suspect the others as well.

Parents
  • 34510
    Offline posted

    Hi ifdef,

    The behavior you are seeing is expected.  The value in the editor is not validated against the ValueConstraint until the editor tries to exit edit mode.  If you delete the value and try to tab out you should see an error message displayed saying that the value cannot be null.

    If you want to keep the user from typing in an empty value during edit mode, you can handle the ValueChanged event and check if the value has been changed to null.  If so, set the value to a non null value.

  • 435
    posted in reply to Robert Stoffers

    Hi Rob,

    Thanks for the reply. But the Infragistics documentation states...

    If the ValueConstraint object is associated with an editor's ValueConstraint property, Nullable indicates if the user is allowed to delete all the contents of the editor. If Nullable is set to False then the user is not allowed to delete all the contents.

    Which makes most sense.

    At present, a user can delete the number and the generic message "Input string was not in a correct format" is shown. This is not very user friendly.

Reply Children