Skip to content

Picker for Xamarin.Forms to ease programming MVVM paradigm

License

Notifications You must be signed in to change notification settings

joacar/BindablePicker

Repository files navigation

BindablePicker

Picker for Xamarin.Forms to ease programming MVVM paradigm by providing a bindable ItemsSource property amongs others

Usage

Unlike Xamarin.Forms.Picker the BindablePicker provides a property ItemsSource to bind a collection of objects to. If the collection is of type INotifyCollectionChanged (ObservableCollection implements this interface) then changes to the collection will be propogated to the Items property.

API

  • ItemsSourceProperty (IList) Bind a list of objects that synchronize with the visual presentation
  • DisplayMemberPath (string) The member of the object to display. Can be nested property expression
  • DisplayMemberFunc (Func<object, string>) Func to create a custom string-representation of the objects
  • SelectedItemProperty (object) The selected object (TwoWay-binding)

Issues

  • Setting the SelectedIndex property before the ItemsSource property will set SelectedIndex to -1 since the Items property is empty cause coerceSelectedIndex returning -1