-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows] Fixed Picker items width wont resize back #33042
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
base: main
Are you sure you want to change the base?
Conversation
|
Hey there @@SubhikshaSf4851! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
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 fixes a Windows-specific Picker resize issue where the Picker control failed to shrink back after its parent container was resized. The root cause was that ComboBox.MinWidth was set when the dropdown opened but never reset when it closed, preventing the control from resizing smaller.
Key Changes:
- Adds logic to reset
ComboBox.MinWidthto 0 when the dropdown closes on Windows - Includes comprehensive UI test coverage with test page and automated test
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Core/src/Handlers/Picker/PickerHandler.Windows.cs |
Adds MinWidth reset logic in OnMauiComboBoxDropDownClosed to allow Picker to resize when parent changes size |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32984.cs |
Implements UI test that verifies Picker resizes correctly after dropdown closes and parent size changes |
src/Controls/tests/TestCases.HostApp/Issues/Issue32984.cs |
Provides test page with Picker and Button to reproduce and verify the resize behavior |
|
|
||
| Button button = new Button | ||
| { | ||
| AutomationId= "issue32984Button", |
Copilot
AI
Dec 9, 2025
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.
Inconsistent spacing in property assignment. There's an extra space after the equals sign:
AutomationId= "issue32984Button",Should be:
AutomationId = "issue32984Button",| AutomationId= "issue32984Button", | |
| AutomationId = "issue32984Button", |
| if (VirtualView is null) | ||
| return; | ||
|
|
||
| if (sender is ComboBox comboBox && comboBox.MinWidth > 0) |
Copilot
AI
Dec 9, 2025
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.
The condition comboBox.MinWidth > 0 is unnecessary. According to the PR description, MinWidth is always set when the dropdown opens (line 135), so it will always be greater than 0 when the dropdown closes. Simplify this to just check for null:
if (sender is ComboBox comboBox)
{
//Reset the MinWidth to allow ComboBox to resize when the parent's size changes
comboBox.MinWidth = 0;
}This is more consistent with line 125 where MinWidth is unconditionally set to 0 in OnControlSelectionChanged.
| if (sender is ComboBox comboBox && comboBox.MinWidth > 0) | |
| if (sender is ComboBox comboBox) |
| #if ANDROID | ||
| App.WaitForElement("Cancel"); | ||
| App.Tap("Cancel"); | ||
| #elif IOS || MACCATALYST | ||
| App.WaitForElement("Done"); | ||
| App.Tap("Done"); | ||
| #elif WINDOWS | ||
| App.TapCoordinates(10, 10); | ||
| #endif |
Copilot
AI
Dec 9, 2025
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.
According to the UI Testing Guidelines (Custom Guideline 1000002), tests should run on all applicable platforms by default unless there is a specific technical limitation. This test uses platform-specific conditional compilation (#if ANDROID, #if IOS || MACCATALYST, #if WINDOWS) to handle different picker dismissal methods, which is acceptable.
However, the critical principle states: "UI tests should run on all applicable platforms (iOS, Android, Windows, MacCatalyst) by default unless there is a specific technical limitation." Since the issue is specifically about Windows resize behavior, consider whether this test truly needs to run on all platforms or if it should be Windows-specific with a clear comment explaining why.
If the test is meant to verify that the fix doesn't break other platforms, keep the platform-specific code. If the test only validates Windows-specific behavior, wrap the entire test in #if WINDOWS with a clear explanation.
|
|
||
| Picker issue32984Picker = new Picker | ||
| { | ||
| AutomationId= "issue32984Picker", |
Copilot
AI
Dec 9, 2025
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.
Inconsistent spacing in property assignment. There's an extra space after the equals sign:
AutomationId= "issue32984Picker",Should be:
AutomationId = "issue32984Picker",This is consistent with the spacing used in line 23 for the Button's AutomationId.
| AutomationId= "issue32984Picker", | |
| AutomationId = "issue32984Picker", |
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!
Root Cause:
ComboBox MinWidth wasn’t reset when the dropdown closed, which prevented it from resizing correctly.
Description of Change
Updated
OnMauiComboBoxDropDownClosedinPickerHandler.Windows.csto reset the ComboBox.MinWidth to 0 when the dropdown closes, allowing the picker to resize with its parent.Already, ComboBox.MinWidth is set in two other places:
Issues Fixed
Fixes #32984
Tested the behavior in the following platforms
Screenshot
beforeFix.mp4
afterFix.mp4