Fixes #5469 - Add editable text mode to NumericUpDown#5587
Merged
Conversation
Copilot
AI
changed the title
[WIP] Enhance NumericUpDown with optional editable text mode
Add editable text mode to NumericUpDown
Jul 7, 2026
Two defects in the new CanEdit mode:
- UpdateNumberView appended the value view after the up button, so the
SubViews order became [down, up, editor]. Because the focus chain is
derived from SubViews order, Tab navigation visited the up button before
the editor, contradicting the visual layout. Insert the value view between
the buttons via MoveSubViewTowardsStart.
- Every parsed keystroke set Value, whose setter reformatted the editor text,
making fractional entry impossible (typing "3." for a {0:0.00} field became
"3.00" immediately). Guard SetText with _editingFromUser so user typing
updates Value without overwriting the in-progress text; the editor still
resyncs on Up/Down and external Value changes.
Tests updated/added accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
BDisp
approved these changes
Jul 8, 2026
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 #5469
Proposed Changes/Todos
NumericUpDown<T>now supports an optional editable mode that preserves the existing compact spinner behavior by default. When enabled, the value region becomes a text editor backed byTextField, allowing direct entry while keeping increment/decrement semantics aligned with the last valid parsed value.Added optional edit mode
CanEdittoNumericUpDown<T>and kept the defaultfalseso current compact rendering stays unchanged.TextField-backed value host and reserves an extra column so the cursor remains visible at the end of the text.Preserved numeric semantics while editing
Valueand re-formats the display throughFormat.Value.Added focused coverage
Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)