[Feature Request] Proposals for input/display improvements and hexadecimal support in NumericUpDown
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start from the UpDownBase.cs base class that the proposed properties (SelectAllOnFocus, DecimalPlaces, Hexadecimal, IsEditable) would extend, and from the Enter-key handling in OnPreviewKeyDown. The hex controls (HexByte through HexUlong) would need new types and default styles. The text-foreground idea touches TextFieldAssist.TextBoxViewForeground. Done would mean maintainers agree which proposals to accept, since the issue is a bundle of design decisions, not one change.
由索引模型根据 Issue 内容生成。
描述
Description
I often build custom NumericUpDown controls to fit my needs. I have extracted some key features and implemented them for verification. While some parts of my implementation might still be unrefined, I would be grateful if you could check the concepts and consider incorporating these ideas into the library.
- Forked Repository for Verification: https://github.com/sandfox922/MaterialDesignInXamlToolkit/commit/99c68edd0bc9556185119537cc5b8a1be86af835#diff-570b0eeb4aa300fe8219e62b4f8f69accda4b993382d4520111712781c9a85c0
1. Extension / Refactoring Ideas for UpDownBase.cs
SelectAllOnFocus(bool): Automatically selects all text when the text area gains focus.DecimalPlaces(int): Handles rounding and formats the display to a fixed number of decimal places (e.g., keeping trailing zeros), similar to standard WinForms/WPF numeric controls.Hexadecimal(bool, protected): Enables hex mode and relies onDecimalPlacesto define the display digit length (accessible only via inheritance).IsEditable(bool): Toggles the underlyingTextBox.IsReadOnlyproperty to make the text area read-only, allowing value changes only through Up/Down button interactions.- Enter Key Behavior: Updates the numeric value and automatically re-selects all text upon pressing the Enter key.
2. Addition of Hexadecimal (Hex) Support Controls
- Introduce dedicated hex controls:
HexByte,HexShort,HexInt,HexLong,HexUshort,HexUint, andHexUlong. Each control would set its ownDefaultStyleKeyand overrideHexadecimaltotrue.
Background & Detailed Use Cases
① Improving Keyboard/Manual Input Workflow
This is intended for scenarios where users need to repeatedly and quickly modify configuration values using only the keyboard, without relying on mouse interactions:
- Control gains focus -> the entire text is selected (
SelectAllOnFocus). - User types the new number.
- User presses the Enter key to confirm the value (handled via
OnPreviewKeyDown). - Upon confirmation, the text automatically returns to a fully selected state.
- This loop allows for seamless, rapid manual data entry.
- Related Features:
SelectAllOnFocus, Enter key confirmation, and restricting input to numeric keys only.
② Enhancing Numerical Visibility & Reducing Human Error
- Consistent Digit Alignment via
DecimalPlaces:
When entering values like1.23,12.3, or123, a lack of aligned decimal places can easily lead to visual misinterpretation. Formatting them as1.230,12.300, and123.000dramatically reduces caret-skipping and reading mistakes while making significant digits obvious. It also stabilizes the control's layout width during Up/Down stepping. - Targeted Foreground Color for the Numeric Part Only:
Sometimes it is useful to turn negative values red or change colors based on thresholds. Currently, settingForeground="Red"turns everything red, includingPrefixTextandSuffixText.
It would be highly beneficial to have a property likematerialDesign:TextFieldAssist.TextBoxViewForegroundto selectively color just the inner text/value field. (Note: I attempted to implement this locally but couldn't get it working perfectly.) - Restricting Direct Typing via
IsEditable:
Useful when you want to prevent arbitrary user typing and restrict changes solely to the Up/Down buttons for data safety.
Thank you for your time and for maintaining this wonderful library. I hope these ideas can be helpful for future updates!
- 主要语言
- C#
- 星标
- 16.3k
- 派生
- 3.5k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MaterialDesignInXAML/MaterialDesignInXamlToolkit 的其他 Issue
-
enhancement up-for-grabs
难度 2/5 1-3 小时 新手友好度 68/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#2485 ·
维护者通常 1 天内回复
-
enhancement evaluation required
难度 5/5 一周以上 新手友好度 25/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#3997 · 1 条评论 ·
维护者通常 1 天内回复
-
bug evaluation required
难度 3/5 1-2 天 新手友好度 45/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#3971 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement evaluation required
难度 5/5 一周以上 新手友好度 35/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#3918 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement evaluation required
难度 5/5 一周以上 新手友好度 35/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#3903 · 5 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 MaterialDesignInXAML/MaterialDesignInXamlToolkit 的全部 Issue
相似的 Issue
-
documentation
难度 1/5 1-3 小时 新手友好度 62/100
-
bug misleading tooling trivial
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
Docs example projects pinned to a literal library version instead of 3.*可能已有人在做 @DaveSkender 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
facioquo/stock-indicators-dotnet#2372 ·
维护者通常 1 天内回复
-
[Docs] officecli-docx SKILL.md still describes `\n` as a soft line break after #262可能已有人在做 @giprime 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
Facepunch/sbox-public#12097 ·
维护者通常 2 天内回复