Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display two items a string and an Image in Xamarin Picker control?

I have a situation where I need to display a picker control in Xamarin like the following way.enter image description here

Where it will display the country Flag and Country code side by side. And the selected country code should display as the background image of the Picker control. (As in the image)

I have just started with Xamarin and found that Picker doesn't have ItemSource property like WPF XAML and it doesn't support DataTemplate too.

Using a listView I can achieve this but ListView Control and Picker controls usability are different.

Can anybody guide me how can I achieve this feature in Picker in Xamarin-XAML?

like image 392
Debhere Avatar asked Sep 11 '25 04:09

Debhere


1 Answers

Picker.Items is an IList<string> so I think you can't do that, because it's made to hold strings only. See: https://developer.xamarin.com/api/property/Xamarin.Forms.Picker.Items/

However you can make another page and on that page place a ListView so that the use can set the language there.

like image 63
Muhammad Azeez Avatar answered Sep 12 '25 18:09

Muhammad Azeez