-
-
Notifications
You must be signed in to change notification settings - Fork 47
Generic Number box #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic Number box #230
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fixes #231
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a generic NumberBox control (NumberBox<T>) that allows for any numeric datatype, replacing the existing WinUI NumberBox that was limited to double values. The PR includes implementations for decimal and integer types (NumberBoxDecimal and NumberBoxInt32), as well as extensive localization resources and a sample application demonstrating the functionality.
- Upgrades target framework from .NET 6 to .NET 8 with C# preview features
- Adds generic NumberBox implementation with strongly typed values
- Includes comprehensive localization resources for over 60 languages
Reviewed Changes
Copilot reviewed 105 out of 105 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| WinUIEx.csproj | Updates target framework to .NET 8 and enables package validation |
| NumberBoxes.xaml.cs | Implements sample page with view model for testing NumberBox controls |
| NumberBoxes.xaml | XAML layout demonstrating the new NumberBox controls with property bindings |
| Generic.xaml | References the new NumberBox resource dictionary |
| ResourceAccessor.cs | Internal utility class for accessing localized string resources |
| Strings/*/Resources.resw | Comprehensive localization files for NumberBox automation and status messages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@MPITech I would appreciate if you could try the latest version out. It handles un-set values using |
haha wrong account the first time. This is a welcome change, since most of my bound fields were nullable decimals and would have required a converter to bind. Will check it out within 24 hours. |
|
@dotMorten This looks pretty good. I checked the following when bound to a nullable decimal property to/from MariaDB using EF Core and all worked well:
I have some additional suggestions I will file in Issues. But this is a good change. |
Ports WinUI's
NumberBoxtoNumberBox<T>to allow for any numeric datatype. Exposes two out of the box:NumberBoxDecimalandNumberBoxInt32but you can extend with your own by creating the class:and duplicating the control template from the other controls and updating the target type.
Note: To be able to assign Decimal values to the NumberBoxDecimal control, it can't be done in XAML (although x:Bind works). Support for decimal values is a limitation in the Windows App SDK and is supposed to be addressed in v1.8, but is currently not available in 1.8preview1 (see microsoft/WindowsAppSDK#5756)