3
votes

I am using Picker for displaying the items,I want to select multiple rows in picker, is there any way to achieve this in Xamarin Forms shared code or through rendering? any suggestion or idea would be much appreciated.

Thanks.

2
There's no easy way. The Picker Class Reference shows there is a SelectedIndex property, but no SelectedItems collection. api.xamarin.com/index.aspx?link=T%3AXamarin.Forms.Picker - Richard Garside
@RichardGarside Can it be done using iOS renderer?? Any example or samples to achieve it?? - Femil Shajin

2 Answers

2
votes

I don't would use Picker for multilselection. You can do this with a ListView (100% XF-Code).
I have posted some code some time ago in the XF-forum:

http://forums.xamarin.com/discussion/17885/multiselect-listviews

If you have to show the "Multiselect-ListView" from a ScrollView, you may also be interested to use the PopUp-Control (XLabs): https://forums.xamarin.com/discussion/33587/how-to-use-a-listview-in-a-scrollview-with-xlabs-popup-control#latest

And finally, if you want to install the XLabs-NuGet, a further posting to XLabs may help you (search for "How to install, setup and use XLabs" in the XF-forum).
As i don't have more than 10 rep-points here, I am not able to post more then two links :-)

Hope this helps...

1
votes

No there isn't.

The Picker Class, has SelectedIndex property, but no SelectedItems collection. Also, the native control under the hood on iOS doesn't support selecting multiple rows and I don't think the Android or Windows one do either.

You could create use a Custom Renderer if there was a native control you wanted to use. But, it would probably be easier to use a ListView control and add some events and style it to look and behave like you want.