Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Feature Request] Proposals for input/display improvements and hexadecimal support in NumericUpDown

Đang mở
#4,108 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
15/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
desktop

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement evaluation required
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.

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 on DecimalPlaces to define the display digit length (accessible only via inheritance).
  • IsEditable (bool): Toggles the underlying TextBox.IsReadOnly property 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, and HexUlong. Each control would set its own DefaultStyleKey and override Hexadecimal to true.

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:

  1. Control gains focus -> the entire text is selected (SelectAllOnFocus).
  2. User types the new number.
  3. User presses the Enter key to confirm the value (handled via OnPreviewKeyDown).
  4. Upon confirmation, the text automatically returns to a fully selected state.
  5. 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 like 1.23, 12.3, or 123, a lack of aligned decimal places can easily lead to visual misinterpretation. Formatting them as 1.230, 12.300, and 123.000 dramatically 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, setting Foreground="Red" turns everything red, including PrefixText and SuffixText.
    It would be highly beneficial to have a property like materialDesign:TextFieldAssist.TextBoxViewForeground to 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!

Ngôn ngữ chính
C#
Star
16.3k
Fork
3.5k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của MaterialDesignInXAML/MaterialDesignInXamlToolkit

Tất cả issue của MaterialDesignInXAML/MaterialDesignInXamlToolkit

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.