Hi Infragistics,
The documentation states that the Value property will only be updated if the value entered is valid.
Let's say we have a ValueConstraint as follows (in a style)...
<Setter Property="ValueConstraint">
<Setter.Value>
<ig:ValueConstraint ValidateAsType="Integer32" MinInclusive="10" MaxInclusive="1000"/>
</Setter.Value>
</Setter>
If we type an invalid value (e.g. 5) the Value property is updated, even if the InvalidValueBehavior is RevertValue.
We're using MVVM and binding, so this scenario updates the model with the invalid value, which causes all sorts of issues.
If these controls are to be used for binding in WPF (e.g. MVVM) then the Value property must only be updated if it passes the ValueConstraint.
Hello ifdef,
Thank you for your post!
I have been investigating this issue, and this does appear to be an issue with the control. There is a workaround to this issue though, in that you can set the UpdateSourceTrigger of your Value binding to LostFocus. This will validate and (if the value passes the ValueConstraint) commit the value of the XamNumericInput after you leave edit mode.
This is unexpected behavior of the control, though, and as such I have asked our engineering staff to examine this further. To ensure that it receives attention, I have logged this behavior in our internal tracking system with a development ID of 201674. I have also created a private case for you on this matter so that you can follow this development issue. This case has an ID of CAS-157449-P7H8V7 and you can access it here: https://es.infragistics.com/my-account/support-activity.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Thanks Andrew,
In response to your case message...
I have heard from our developers regarding development issue 201674. This does not appear to be an issue with the control, but rather, it is the way that the processing pipeline of the XamNumericInput works. The XamNumericInput is structured to set the Value property first, then validate the Value, and set the IsValueValid property based on the validation.
This logic contradicts the documentation, which clearly states Value will only be updated if it's valid.
Taking this approach means binding in MVVM (with no code behind) with UpdateSourceTrigger=PropertyChanged (a common scenario) is just not workable.
Maybe you should consider a parameter that will stop Value being updated if it's invalid. That is, Value will always be the last known good value.
Thank you for your response.
I am not entirely sure where in our documentation for the XamNumericInput it states that the Value will only be updated if it is valid, but could you please provide a link to that article, as it sounds like it needs to be updated. I did find an article here though: http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=InfragisticsWPF4.Controls.Editors.XamMaskedInput.v15.1~Infragistics.Controls.Editors.ValueInput~Value.html, which explains the behavior you are currently seeing.
"Note: As the user enters/modifies the contents of the ValueInput, the Text and Value properties will be synchronously updated to reflect the current contents. If the user input can not be parsed into the associated ValueType, the Text property will be updated however the Value property will retain last parsed value. In such a case, the IsValueValid property will return false indicating that the user input is invalid."