Skip to content

Conversation

@NirmalKumarYuvaraj
Copy link
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

This pull request adds command support to the CheckBox control in the Microsoft.Maui.Controls library, enabling developers to bind commands and command parameters to checkboxes, similar to other interactive controls. It also ensures that the enabled state of the checkbox reflects whether its bound command can execute, and includes unit tests to verify command invocation behavior.

Command Support for CheckBox

  • Added Command and CommandParameter bindable properties to CheckBox, allowing developers to bind an ICommand and a parameter for command execution. (src/Controls/src/Core/CheckBox/CheckBox.cs, src/Controls/src/Core/CheckBox/CheckBox.csL22-R54)
  • Implemented the ICommandElement interface in CheckBox, integrating command logic and handling CanExecuteChanged to update the enabled state. (src/Controls/src/Core/CheckBox/CheckBox.cs, [1] [2] [3]
  • Overrode IsEnabledCore so that the checkbox is disabled when its command cannot execute. (src/Controls/src/Core/CheckBox/CheckBox.cs, src/Controls/src/Core/CheckBox/CheckBox.csR136-R140)

API Surface Updates

  • Updated the public API files for all platforms to reflect the new Command, CommandParameter, and IsEnabledCore members for CheckBox, ensuring proper documentation and tooling support. (src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt, [1] [2]; src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt, [3] [4]; src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt, [5] [6]; src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt, [7] [8]; src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt, [9] [10]; src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt, [11] [12]; src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt, [13] [14]

Testing

Original PR - #20717

Issues Fixed

Fixes #7394

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Aug 6, 2025
@NirmalKumarYuvaraj NirmalKumarYuvaraj marked this pull request as ready for review August 13, 2025 04:05
Copilot AI review requested due to automatic review settings August 13, 2025 04:05
@NirmalKumarYuvaraj NirmalKumarYuvaraj requested a review from a team as a code owner August 13, 2025 04:05
Copy link
Contributor

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 pull request adds command support to the CheckBox control in .NET MAUI, enabling developers to bind ICommand instances and command parameters to checkboxes similar to other interactive controls like Button. The implementation includes proper command execution handling, disabled state management when commands cannot execute, and comprehensive testing.

Key changes:

  • Added Command and CommandParameter bindable properties to CheckBox with proper command execution logic
  • Implemented ICommandElement interface to integrate with existing command infrastructure and handle CanExecuteChanged events
  • Added comprehensive unit tests and UI tests to verify command functionality

Reviewed Changes

Copilot reviewed 13 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Controls/src/Core/CheckBox/CheckBox.cs Core implementation adding Command/CommandParameter properties and ICommandElement interface
src/Controls/tests/Core.UnitTests/CheckBoxUnitTests.cs Comprehensive unit tests for command execution scenarios
src/Controls/tests/TestCases.HostApp/FeatureMatrix/CheckBox/CheckBoxViewModel.cs ViewModel updates to support command testing in UI tests
src/Controls/tests/TestCases.HostApp/FeatureMatrix/CheckBox/CheckBoxControlPage.xaml UI test page updates with command parameter entry and status labels
src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CheckBoxFeatureTests.cs UI tests validating command execution behavior
src/Controls/docs/Microsoft.Maui.Controls/CheckBox.xml Documentation for new Command and CommandParameter properties
Multiple PublicAPI files Public API surface updates for all target frameworks

Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

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

@NirmalKumarYuvaraj
Copy link
Contributor Author

Thanks, but the docs should be inline, you can learn more with the documentation here

https://github.com/dotnet/maui/blob/main/docs/CodeDocumentationGuidelines.md

@rmarinho , I have added inline docs. please let me know if you have any concerns.

@PureWeen
Copy link
Member

/rebase

@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label Aug 16, 2025
@PureWeen PureWeen added this to the .NET 10.0-rc1 milestone Aug 16, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Aug 16, 2025
@dotnet dotnet deleted a comment from azure-pipelines bot Aug 18, 2025
@dotnet dotnet deleted a comment from PureWeen Aug 18, 2025
@dotnet dotnet deleted a comment from azure-pipelines bot Aug 18, 2025
Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

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

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing Aug 18, 2025
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen moved this from Changes Requested to Ready To Review in MAUI SDK Ongoing Aug 19, 2025
@rmarinho
Copy link
Member

@PureWeen
Copy link
Member

/backport to release/10.0.1xx-rc1

@github-actions
Copy link
Contributor

@NirmalKumarYuvaraj
Copy link
Contributor Author

CheckBox_ChangeColor_VerifyVisualState failing for iOS and Android. DO we need new images?

https://dev.azure.com/xamarin/public/_build/results?buildId=148831&view=ms.vss-test-web.build-test-results-tab&runId=4784293&resultId=100021&paneView=debug

CheckBox_ChangeColor_VerifyVisualState-2 CheckBox_ChangeColor_VerifyVisualState

@rmarinho , Yes we need the new images. Please let me know if you have any concerns.

@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

/backport to release/10.0.1xx-rc1

@github-actions
Copy link
Contributor

@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Aug 20, 2025
@rmarinho rmarinho merged commit 1062a7a into dotnet:net10.0 Aug 20, 2025
148 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Aug 20, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution p/0 Current heighest priority issues that we are targeting for a release. partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants