fix(DoubleUpDown): revert to previous value on out-of-range input with ClipValueToMinMax=false (fixes #1801)#1809
Open
JyslaFancy wants to merge 1 commit into
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.