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 & DataErrors
posted

Hi Infragistics,

We're finding that this control (and I assume all other XamMaskedInput) derivatives are just not working well with MVVM.

Take for example this scenario...

We've set the following ValueConstraint in a style...

<Setter Property="ValueConstraint">

    <Setter.Value>

        <ig:ValueConstraint ValidateAsType="Integer32" MinInclusive="10" MaxInclusive="1000"/>

    </Setter.Value>

</Setter>

If the user types an invalid value (e.g. 5) a message is displayed (if the InvalidValueBehavior is DisplayErrorMessage) and the source property it's bound to is updated (see my other thread about that).

Once you click ok, it's possible to then freely click on another control and both the control and model now have incorrect values.

Given that we're using the standard .Net IDataErrorInfo interface, our View Model now thinks there are no validation errors. Basically the use of a MessageBox just doesn't work with binding & MVVM.

Why not introduce another InvalidValueBehavior of RaiseDataError?

Parents
No Data
Reply
  • 435
    posted

    Just to add to that...

    If we set InvalidValueBehavior to RevertValue, this does throw an exception. If the binding is then marked with ValidateOnExceptions it does come through as a DataError.

    The trouble is, it's a very generic Value '' could not be converted message, which is not very user friendly.

    What would be perfect is for an option where all validation messages are raised as DataErrors with friendly messages.

Children