fix(DoubleUpDown): revert to previous value on out-of-range input with ClipValueToMinMax=false (fixes #1801)#1809
Conversation
…h ClipValueToMinMax=false When ClipValueToMinMax=false and the user enters an out-of-range value then tabs away (UpdateSourceTrigger=LostFocus), the control was silently truncating digits to bring the value within Min/Max range. For example, with Max=20000, typing 123456 would set the VM property to 12345 instead of reverting to the original valid value. Root cause: The intermediate valid values typed (e.g. 12345) were being committed to the internal Value property during typing. On LostFocus, when the final value (123456) was out of range, the text was reverted to the last committed intermediate value instead of the pre-edit value. Fix: Save the initial Value on focus gain (_initialValueOnFocus), and restore it in the SyncTextAndValueProperties catch block when ClipValueToMinMax=false and the user is not actively typing. Fixes xceedsoftware#1801
Thanks for the report and the fix in #1801 — we merged it into Your diagnosis was right: partial values like We kept your approach and added a couple of small things on our side so the bound property also updates correctly with Appreciate you taking the time to document this. |
Fixes #1801 — DoubleUpDown with ClipValueToMinMax=false silently truncates digits instead of reverting.
Problem
When ClipValueToMinMax=false and user enters an out-of-range value then tabs away (UpdateSourceTrigger=LostFocus), the control silently truncates digits. For example with Max=20000, typing 123456 sets the VM property to 12345.
Root cause
Intermediate valid values (e.g. 12345) were committed to the internal Value property during typing via SyncTextAndValueProperties. On LostFocus, when the final value was out of range, the catch block raised a validation error but the display text was reverted to the last committed intermediate value.
Fix
This ensures the control reverts to the correct pre-edit value instead of a truncated intermediate value.