Description
Description
Currently, on iOS, the picker uses a slightly hacky button, which opens a popover and the native UIPickerView control. This isn't very elegant. However the main problem is that this core control is completely broken on Mac Catalyst when using the native mac idiom. It can't even run, because of limitations inherent to mac catalyst and the UIPicker control.
A solution, which would also align the iOS Picker with its android and windows counterparts, would be to replace this with a UIButton that has ShowsMenuAsPrimaryAction = true
and ChangesSelectionAsPrimaryAction = true
.
Here's an example, which currently works:
protected override UIKit.UIView CreatePlatformView()
{
UIMenuElement[] menuElements = new UIMenuElement[]{
UIAction.Create("Option 1",null,null,(args)=>{}),
UIAction.Create("Option 2",null,null,(args)=>{}),
UIAction.Create("Option 3",null,null,(args)=>{})
};
var button = new UIButton(UIButtonType.System);
button.Menu = UIMenu.Create(menuElements);
button.ShowsMenuAsPrimaryAction = true;
button.ChangesSelectionAsPrimaryAction = true;
return button;
}
On macOS, you get exactly what you would expect from a picker control:
And iOS also feels and looks great to use, a lot better than the current control:
Public API Changes
No API Changes, this would be a replacement of the underlying native control on iOS.
Intended Use-Case
Any time that a picker is needed on iOS or macOS.