KEMBAR78
Picker doesn't show selected item on Android · Issue #19681 · dotnet/maui · GitHub
Skip to content

Picker doesn't show selected item on Android #19681

@fedemkr

Description

@fedemkr

Description

When the user opens the Picker on Android it will show an alert dialog with the options to select but it's not showing the currently selected option. I think this is a UX issue given that if the dialog covers the picker EditText then the user needs to cancel the action to check what was currently selected.
I think the problem is that on the PickerHandler.Android implementation SetItems is being used as you can see here but in my opinion SetSingleChoiceItems should be used which would enrich the dialog displaying the current selected option.
I guess something like this should work:

builder.SetSingleChoiceItems(items, VirtualView.SelectedIndex, (s, e) =>
{
	var selectedIndex = e.Which;
	VirtualView.SelectedIndex = selectedIndex;
	base.PlatformView?.UpdatePicker(VirtualView);
});

If the change can't directly be added because is a change in current UI/UX behavior and everyone may not be in favor of this, could a Mode be added there so we can choose how to show the items?

Steps to Reproduce

Just add a Picker to some page with options to select.

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms on the non-AppCompat version but using a NumberPicker which IMO is not ideal.

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-pickerPickermigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertp/2Work that is important, but is currently not scheduled for releasepartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androidproposal/underconsiderations/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions