Picker ItemTemplate

predalphapredalpha FRMember ✭✭
edited September 8 in Xamarin.Forms Evolution

Summary

A Picker allowing to apply a DataTemplate (DataTemplateSelector) to display more detailed informations.
And why not a grouping one above?

API Changes

  public DataTemplate ItemTemplate
        {
            get { return (DataTemplate)GetValue(ItemTemplateProperty); }
            set { SetValue(ItemTemplateProperty, value); }
        }

        public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create(nameof(ItemTemplate),
                                                                                               typeof(DataTemplate),
                                                                                               typeof(Picker),
                                                                                               default(DataTemplate),
                                                                                               propertyChanged: OnItemTemplateChanged);

Intended Use Case

Today, the native Xamarin.Forms Picker view allows developpers to bind an ItemSource and to display a line of text via ItemDisplayBinding property.
It could be interesting to display more accurate datas as a text line can be very limitating.

For example we could diplay a list of countries with theirs flags images. Moreover a grouping template could be interesting as we could then display continents and their respective countries.

I imagine that we can find workarounds as opening a modal page including a listview but i think having that native templated control could be a very interesting feature.

Whats your opinion ?

0
0 votes

Open · Last Updated

Sign In or Register to comment.