Skip to content

Conversation

@SubhikshaSf4851
Copy link
Contributor

@SubhikshaSf4851 SubhikshaSf4851 commented Dec 8, 2025

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 OnMauiComboBoxDropDownClosed in PickerHandler.Windows.cs to 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:

  • When opening the ComboBox, where ComboBox.ActualWidth is assigned to ComboBox.MinWidth. So, the ComboBox.MinWidth will always be set every time the ComboBox is opened.
  • After selecting an item, where 0 is already assigned to ComboBox.MinWidth, similar to our fix, and this also triggers the ComboBox’s closed event.

Issues Fixed

Fixes #32984

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix
beforeFix.mp4
afterFix.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Dec 8, 2025
@dotnet-policy-service
Copy link
Contributor

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.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 8, 2025
@sheiksyedm
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@sheiksyedm sheiksyedm marked this pull request as ready for review December 9, 2025 11:10
Copilot AI review requested due to automatic review settings December 9, 2025 11:10
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 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.MinWidth to 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",
Copy link

Copilot AI Dec 9, 2025

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",
Suggested change
AutomationId= "issue32984Button",
AutomationId = "issue32984Button",

Copilot uses AI. Check for mistakes.
if (VirtualView is null)
return;

if (sender is ComboBox comboBox && comboBox.MinWidth > 0)
Copy link

Copilot AI Dec 9, 2025

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.

Suggested change
if (sender is ComboBox comboBox && comboBox.MinWidth > 0)
if (sender is ComboBox comboBox)

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +30
#if ANDROID
App.WaitForElement("Cancel");
App.Tap("Cancel");
#elif IOS || MACCATALYST
App.WaitForElement("Done");
App.Tap("Done");
#elif WINDOWS
App.TapCoordinates(10, 10);
#endif
Copy link

Copilot AI Dec 9, 2025

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.

Copilot generated this review using guidance from repository custom instructions.

Picker issue32984Picker = new Picker
{
AutomationId= "issue32984Picker",
Copy link

Copilot AI Dec 9, 2025

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.

Suggested change
AutomationId= "issue32984Picker",
AutomationId = "issue32984Picker",

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

area-controls-picker Picker community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Picker items width won't resize back when its container window gets resized down.

3 participants