-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixed Picker Items are not Displaying on macOS platform #27535
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
Merged
PureWeen
merged 13 commits into
dotnet:inflight/current
from
NanthiniMahalingam:fix-27474
Aug 7, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c64f6fc
Fixed the picker view items source does not display on mac platform
NanthiniMahalingam 0c2ed2d
Added the test case
NanthiniMahalingam d8fd1be
Added the output images.
NanthiniMahalingam d200887
Merge remote-tracking branch 'upstream/main' into fix-27474
NanthiniMahalingam 447eaef
Fixed the picker view items source does not display on mac platform
NanthiniMahalingam 9fe396e
Added the test case
NanthiniMahalingam e9d39ad
Added the output images.
NanthiniMahalingam 3e03701
Create ShouldDisplayPickerItemsWhenOpeningPicker.png
NanthiniMahalingam d401e0f
Ignore the test case on catalyst platform
NanthiniMahalingam 0d996ad
Added the test case for mac platform
NanthiniMahalingam f5942cb
Added the macOS output image
NanthiniMahalingam 41ebe9c
Merge branch 'fix-27474' of https://github.com/NanthiniMahalingam/mau…
NanthiniMahalingam bd92cba
Added the comment line for fix.
NanthiniMahalingam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+21.4 KB
...s.Android.Tests/snapshots/android/ShouldDisplayPickerItemsWhenOpeningPicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Controls.TestCases.HostApp.Issues; | ||
|
||
[Issue(IssueTracker.Github, 27474, "Picker view items are not displayed when setting the title on the picker control", PlatformAffected.macOS)] | ||
public class Issue27474 : ContentPage | ||
{ | ||
public Issue27474() | ||
{ | ||
Content = new Picker | ||
{ | ||
AutomationId = "Picker", | ||
ItemsSource = new List<string> { "Badminton", "Football", "Cricket", "Chess", "Swimming" }, | ||
Title = "Select sports", | ||
}; | ||
} | ||
} |
Binary file added
BIN
+24.4 KB
...TestCases.Mac.Tests/snapshots/mac/ShouldDisplayPickerItemsWhenOpeningPicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27474.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue27474 : _IssuesUITest | ||
{ | ||
public Issue27474(TestDevice testDevice) : base(testDevice) | ||
{ | ||
} | ||
|
||
public override string Issue => "Picker view items are not displayed when setting the title on the picker control"; | ||
|
||
[Test] | ||
[Category(UITestCategories.Picker)] | ||
public void ShouldDisplayPickerItemsWhenOpeningPicker() | ||
{ | ||
App.WaitForElement("Picker"); | ||
App.Click("Picker"); | ||
VerifyScreenshot(); | ||
} | ||
} | ||
} |
Binary file added
BIN
+9.04 KB
...ses.WinUI.Tests/snapshots/windows/ShouldDisplayPickerItemsWhenOpeningPicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+68.7 KB
...TestCases.iOS.Tests/snapshots/ios/ShouldDisplayPickerItemsWhenOpeningPicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,8 +49,9 @@ void DisplayAlert(MauiPicker uITextField) | |
var pickerView = new UIPickerView(frame); | ||
pickerView.Model = new PickerSource(this); | ||
pickerView?.ReloadAllComponents(); | ||
|
||
var pickerController = UIAlertController.Create(VirtualView.Title, "", UIAlertControllerStyle.ActionSheet); | ||
// The UIPickerView is displayed as a subview of the UIAlertController when an empty string is provided as the title, instead of using the VirtualView title. | ||
// This behavior deviates from the expected native macOS behavior. | ||
var pickerController = UIAlertController.Create("", "", UIAlertControllerStyle.ActionSheet); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't look like a proper fix, but a hack to get it working There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @StephaneDelcroix ,
![]() ![]()
jsuarezruiz marked this conversation as resolved.
Show resolved
Hide resolved
jsuarezruiz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// needs translation | ||
pickerController.AddAction(UIAlertAction.Create("Done", | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 test is failing on Mac because the reference snapshot is pending. Already available in the latest build.

Could you commit it?
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.
I've committed the macOS output image. Could you please verify it?