Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue32984.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, "32984", "Picker on resize not working on Windows", PlatformAffected.UWP)]
public class Issue32984 : ContentPage
{
public Issue32984()
{
VerticalStackLayout layout = new VerticalStackLayout
{
WidthRequest = 600
};

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.
Title = "Select an item",
HorizontalOptions = LayoutOptions.Fill,
ItemsSource = new List<string> { "Item1", "Item2", "Item3"}
};

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.
Text = "Click me",
HorizontalOptions = LayoutOptions.Fill
};

button.Clicked += (s, e) => { layout.WidthRequest = 200; };

layout.Children.Add(issue32984Picker);
layout.Children.Add(button);

Content = layout;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue32984 : _IssuesUITest
{
public Issue32984(TestDevice device)
: base(device)
{
}

public override string Issue => "Picker on resize not working on Windows";

[Test]
[Category(UITestCategories.Picker)]
public void Issue32984PickerShouldResize()
{
App.WaitForElement("issue32984Button");
App.Tap("issue32984Picker");
#if ANDROID
App.WaitForElement("Cancel");
App.Tap("Cancel");
#elif IOS || MACCATALYST
App.WaitForElement("Done");
App.Tap("Done");
#elif WINDOWS
App.TapCoordinates(10, 10);
#endif
App.Tap("issue32984Button");
App.Tap("issue32984Picker");
VerifyScreenshot();
}
}
6 changes: 6 additions & 0 deletions src/Core/src/Handlers/Picker/PickerHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ void OnMauiComboBoxDropDownClosed(object? sender, object e)
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.
{
//Reset the MinWidth to allow ComboBox to resize when the parent's size changes
comboBox.MinWidth = 0;
}

VirtualView.IsOpen = false;
}
}
Expand Down
Loading