Skip to content

Conversation

@michaelstonis
Copy link
Contributor

Introduces a comprehensive suite of numeric value converters for flexible, culture-aware formatting in .NET MAUI applications.

  • Includes converters for currency, percentage, decimal, custom formats, and precision control.
  • Provides NumericEntryBehavior and NumericFormatting attached properties for enhanced input fields with live validation, constraints, and rounding modes.

Upgrades the project to .NET 10:

  • Updates target frameworks, SDK versions, and relevant NuGet packages across the solution.
  • Refactors platform-specific effects for keyboard done buttons on iOS and MacCatalyst.

Adds a dedicated test page and extensive documentation for the new numeric formatting capabilities.
Refines CalendarPicker event arguments for consistency.

Updates the project to target .NET 10.0 and its corresponding platform-specific targets.

Significant changes:

*   Upgrades target frameworks to .NET 10.0 in the test application and the main library project.
*   Bumps package versions for several dependencies including ReactiveUI, CommunityToolkit, and Microsoft.Maui.Controls.
*   Updates references to platform-specific keyboard handling.
*   Removes unused files.
*   Changes event arguments from `NullableDateChangedEventArgs` to `DateChangedEventArgs`.
*   Adds the SourceGen inflator for XAML.
Updates the .NET runtime version used in the NuGet build workflows.

Significant changes:

*   Changed the DotnetVersion environment variable in the beta and prod workflows.
*   The updated version is 10.0.1.
Updates the .NET runtime version used in the NuGet build workflows for both beta and production releases.

Significant changes:

*   Changed the DotnetVersion environment variable in the workflow files.
Introduces a powerful suite of numeric value converters and utilities to enhance input control functionality.

*   Establishes a robust base for numeric formatting, handling common type conversions, null values, and error management.
*   Provides specialized converters for diverse formatting needs, including culture-aware currency, percentage, decimal, and custom format string application.
*   Enables dynamic formatting for input fields through a dedicated behavior that applies formatting on unfocus, allowing raw input during editing.
*   Offers declarative numeric formatting for entry controls via attached properties, simplifying XAML configuration.
*   Includes a markup extension for streamlined instantiation of common numeric format converters directly in XAML.
*   Updates the test application with a dedicated page to showcase and validate all new numeric formatting features and their edge cases.
*   Adds a utility converter for double-to-float type conversions, supporting property editors in the test application.
Adds new test sections for numeric value converters and entry behaviors.

* Introduces examples for real-time formatting with two-way data binding.
* Showcases formatted entry fields using a numeric behavior with various constraints.
* Improves the numeric entry behavior to correctly format initial text upon load.
* Introduces detailed control over decimal precision in numeric input.
* Adds options for setting maximum and minimum fractional digits.
* Implements various rounding modes for precise value manipulation.
* Allows configuring whether decimal precision is enforced during input or on unfocus.
* Expands the test application to showcase new decimal precision capabilities.
* Updates documentation to reflect the new numeric value converters and behavior enhancements.
Copilot AI review requested due to automatic review settings December 22, 2025 22:38
Copy link

Copilot AI left a 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 comprehensive numeric input formatting capabilities and attempts to upgrade to .NET 10. However, there are critical issues with the .NET 10 upgrade as that version doesn't exist yet (latest is .NET 9). The numeric value converter implementation appears well-designed and thoroughly documented.

Key Changes:

  • Adds numeric value converters (Currency, Percent, Decimal, Custom, Precision) with culture-aware formatting
  • Introduces NumericEntryBehavior for live input validation and formatting
  • Attempts to upgrade to .NET 10 (does not exist - critical blocker)
  • Refactors platform-specific effects for iOS and MacCatalyst
  • Replaces NullableDateChangedEventArgs with standard DateChangedEventArgs

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
global.json CRITICAL: Updates SDK to non-existent "10.0.0"
AuroraControlsMaui/AuroraControls.Maui.csproj CRITICAL: References non-existent net10.0 frameworks and packages
AuroraControls.TestApp/AuroraControls.TestApp.csproj CRITICAL: References non-existent net10.0 and package versions
.github/workflows/*.yml CRITICAL: References non-existent .NET 10.0.101
Directory.build.props Updates analyzer package versions (may not exist)
AuroraControlsMaui/Converters/*.cs Adds well-structured numeric formatting converters
AuroraControlsMaui/Platforms/iOS/*.cs Renames effect class to avoid naming conflicts
AuroraControlsMaui/Platforms/MacCatalyst/*.cs Renames effect class to avoid naming conflicts
AuroraControlsMaui/CalendarPicker.cs Updates event args to use standard DateChangedEventArgs
AuroraControls.TestApp/NumericConvertersTestPage.* Adds comprehensive test page for numeric converters
README.md Adds extensive documentation for numeric formatting features
docs/NUMERIC_VALUE_CONVERTERS_PLAN.md Adds detailed implementation plan (has future date issue)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +469 to +475
foreach (var c in fractionPart)
{
if (char.IsDigit(c))
{
fractionDigitCount++;
}
}
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This foreach loop implicitly filters its target sequence - consider filtering the sequence explicitly using '.Where(...)'.

Copilot uses AI. Check for mistakes.
Comment on lines +388 to +397
if (!_currentValue.HasValue && !string.IsNullOrWhiteSpace(_entry.Text))
{
if (TryParseValue(_entry.Text, out var parsedValue))
{
_currentValue = ApplyConstraints(parsedValue);
}
}

// Now format if we have a value
if (_currentValue.HasValue)
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 'if' statements can be combined.

Suggested change
if (!_currentValue.HasValue && !string.IsNullOrWhiteSpace(_entry.Text))
{
if (TryParseValue(_entry.Text, out var parsedValue))
{
_currentValue = ApplyConstraints(parsedValue);
}
}
// Now format if we have a value
if (_currentValue.HasValue)
if (!_currentValue.HasValue &&
!string.IsNullOrWhiteSpace(_entry.Text) &&
TryParseValue(_entry.Text, out var parsedValue))
{
_currentValue = ApplyConstraints(parsedValue);
}
// Now format if we have a value
if (_currentValue.HasValue)
if (_currentValue.HasValue)

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +64
string formattedValue;

if (string.IsNullOrEmpty(format))
{
// Use general format
formattedValue = value.ToString(culture);
}
else
{
formattedValue = value.ToString(format, culture);
}

Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.

Suggested change
string formattedValue;
if (string.IsNullOrEmpty(format))
{
// Use general format
formattedValue = value.ToString(culture);
}
else
{
formattedValue = value.ToString(format, culture);
}
string formattedValue = string.IsNullOrEmpty(format)
? value.ToString(culture) // Use general format
: value.ToString(format, culture);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants