Browse Source

fix(DoubleUpDown): revert to previous value on out-of-range input with 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 #1801
pull/1809/head
Harald Daltveit 2 months ago
parent
commit
9a90238178
  1. 1875
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs

1875
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Primitives/UpDownBase.cs

File diff suppressed because it is too large
Loading…
Cancel
Save