question

LloydSheen-3317 avatar image
0 Votes"
LloydSheen-3317 asked WenyanZhang-MSFT commented

Have Picker scroll to currently selected item on dropdown of the list

Cannot find anything about how to cause the Picker control to scroll to the selected item when the dropdown is opened.

I have a Picker that can have many items and it is a pain having to scroll manually to get to where you were on last selection. Also when you do scroll there is no indication of what item was selected (I know it is in the top of the Picker control).

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·

1 Answer

WenyanZhang-MSFT avatar image
0 Votes"
WenyanZhang-MSFT answered

Hello,

On iOS platform, it will scroll to the selected item when the picker is opened. But on Android platform, the picker can't scroll to the selected item.

In the Android source code, we can see there is a NumberPicker displaying the string value. We need to record the scrollX and scrollY when an item is selected so that we can scroll the picker by ScrollBy or ScrollTo method when the picker is open.

But this NumberPicker is a local variable, we can't get the instance even through Custom Renderers (PickerRenderer). So I have to say, you can't implement this feature by the current API. You could try to create a new issue on GitHub for your feature request:
https://github.com/xamarin/Xamarin.Forms/issues/new/choose

Best Regards,
Wenyan Zhang


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.