NumericUpDownLib icon indicating copy to clipboard operation
NumericUpDownLib copied to clipboard

Invalid Value does not fire on lost focus or property changed

Open danweav1 opened this issue 1 year ago • 0 comments

When the user enters in their own number, if it is invalid, the property changed event does not fire nor does the lost focus event if that is used instead. The underlying value is not changed either, but the invalid number is still displayed in the updown control. Is there a way to revert to the last good number?

For example, say I have the following:

<numericupdownlib:DoubleUpDown
    MinValue="0"
    Value="{Binding TestValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

The user can type in a value below 0 like so: image

However, the underlying value remains at 0. No propertychanged event is fired, and no lost focus event when focusing a different control. The invalid value stays in the box until the user changes it to something valid, presses the up button, or changes the value in the code behind. It feels like a disconnect because what the user sees and what the underlying value is is different.

danweav1 avatar Aug 21 '23 01:08 danweav1