I have a simple XamCurrencyEditor bound to a non nullable decimal property.
However, i can simply select the entire content, including the currency symbol and press delete or backspace. I get a red border and my bound property does not update itself Not to 0 and not to null. There is no mention of binding errors in my console.
<igEditors:XamCurrencyEditor Value="{Binding Settings.DecimalProperty, UpdateSourceTrigger=PropertyChanged}"/>
Hi Martin,
I have been investigating into the behavior you are seeing and the best thing I can recommend in this case is that you add a ValueConstraint to the XamCurrencyEditor with the “Nullable” property set to “False.” You can do this using the code below:
<igWPF:XamCurrencyEditor Value="{Binding MyDecimal, UpdateSourceTrigger=PropertyChanged}"> <igWPF:XamCurrencyEditor.ValueConstraint> <igWPF:ValueConstraint Nullable="False" /> </igWPF:XamCurrencyEditor.ValueConstraint> </igWPF:XamCurrencyEditor>
What this will do is if you try to leave the editor and the value is blank, it will throw out a message box saying that the value is empty, prompting the user to enter a valid value, and focus will remain in the editor until this is done.
Regarding the reason why your binding does not update, this is because null is not a valid Value for a bound decimal type, and so the editor gets a red border to designate that the attempted entered value is not valid, and the underlying binding is not updated to reflect that value. Being that the underlying binding is not updated, it will remain as the previous value until a valid value is entered into the editor.
Please let me know if you have any other questions or concerns on this matter.