-
Notifications
You must be signed in to change notification settings - Fork 1.9k
NET 10 - Added command and command parameter for CheckBox control #31036
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
Conversation
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 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
CommandandCommandParameterbindable properties to CheckBox with proper command execution logic - Implemented
ICommandElementinterface to integrate with existing command infrastructure and handleCanExecuteChangedevents - 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 |
src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/CheckBoxFeatureTests.cs
Outdated
Show resolved
Hide resolved
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.
Thanks, but the docs should be inline, you can learn more with the documentation here
@rmarinho , I have added inline docs. please let me know if you have any concerns. |
|
/rebase |
0db8caf to
7f7df81
Compare
…CheckBoxFeatureTests.cs Co-authored-by: Copilot <[email protected]>
7f7df81 to
d2878a5
Compare
rmarinho
left a comment
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.
Seems this test is failing CheckBox_VerifyCheckedChangedEvent
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/backport to release/10.0.1xx-rc1 |
|
Started backporting to release/10.0.1xx-rc1: https://github.com/dotnet/maui/actions/runs/17076165102 |
@rmarinho , Yes we need the new images. Please let me know if you have any concerns. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/backport to release/10.0.1xx-rc1 |
|
Started backporting to release/10.0.1xx-rc1: https://github.com/dotnet/maui/actions/runs/17096212678 |




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
CheckBoxcontrol 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
CommandandCommandParameterbindable properties toCheckBox, allowing developers to bind anICommandand a parameter for command execution. (src/Controls/src/Core/CheckBox/CheckBox.cs, src/Controls/src/Core/CheckBox/CheckBox.csL22-R54)ICommandElementinterface inCheckBox, integrating command logic and handlingCanExecuteChangedto update the enabled state. (src/Controls/src/Core/CheckBox/CheckBox.cs, [1] [2] [3]IsEnabledCoreso 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
Command,CommandParameter, andIsEnabledCoremembers forCheckBox, 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
CanExecuteis true, and not executed otherwise. (src/Controls/tests/Core.UnitTests/CheckBoxUnitTests.cs, src/Controls/tests/Core.UnitTests/CheckBoxUnitTests.csR66-R95)Original PR - #20717
Issues Fixed
Fixes #7394