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.
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.
Hi Rob,
I try to revert the value when the control's value is invalid. But seems there is a bug in xamNumericInput when it has not allow null value constrain.
Try to run below codes. it will throw some exceptions in VS output window. So when you loaded a lot of this kind of xamNumericInput, it will cost many seconds.This is a performance issue. Can you help me?
<ig:XamNumericInput x:Name="maskInput" ValueTypeName="Decimal" Value="{Binding EditValue,UpdateSourceTrigger=LostFocus}" InvalidValueBehavior="RevertValue"><ig:XamMaskedInput.ValueConstraint><ig:ValueConstraint Nullable="False" /></ig:XamMaskedInput.ValueConstraint></ig:XamNumericInput>
The out put windows exception is following:
A first chance exception of type 'System.FormatException' occurred in mscorlib.dllA first chance exception of type 'System.FormatException' occurred in mscorlib.dllA first chance exception of type 'System.ArgumentException' occurred in InfragisticsWPF4.Controls.Editors.XamMaskedInput.v15.1.dll
Thanks,
Brandon.
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.