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?
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.
Hi ifdef,
I'm not really seeing that behavior. If I have ValidatesOnDataErrors enabled on my binding and I type in a value that IDataErrorInfo considers to be an invalid, when I return the error string the XamNumericInput displays that error string in the red message next to the editor. The only time I see the "Value '' could not be converted" message is when I delete the value and this is because NULL cannot be converted to a double. If the IDataErrorInfo logic checks to see if I typed in a value less than 10 and I type in a 5, the error message displayed is the one returned by IDataErrorInfo. I have attached my sample project showing this.
I'm just checking to see if you have any further questions on this matter.