Skip to content

0rupp/XFMultiPicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XFMultiPicker

ListView Popup with multiselect-feature. It still has many restrictions (i.e. custom DataTemplates), which I will hopefully work on in the future. It uses the ideas from https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/multiselect/. Currently it is implemted as a button, that opens a popup with a ListView in it. ONLY tested with Android yet. Xamarin Forms version of the sample is 2.3.2.127. Update XF if necessary.

##Usage Note

  1. the Model needs a Name (string) property!
  2. the selecteditems collection needs to inform about changes (ICollectionChange -> INotifyPropertyChanged in VM)
  3. the projects uses the Popup Page Plugin for Xamarin Forms: https://github.com/rotorgames/Rg.Plugins.Popup/

Landing

<customControls:MultiPicker x:TypeArguments="models:MyType" 
  ItemsSource="{Binding AvailableItems}" 
  SelectedItems="{Binding SelectedItem}"
  Text="{Binding SelectedItem, Converter={StaticResource JoinListConverter}}" />
public ObservableCollection<MyType> SelectedItems
{
    get { return _selectedItems; }
    set
    {
        if (Equals(value, _selectedItems)) return;
        if (_selectedItems != null)
            _selectedItems.CollectionChanged -= SelectedItemsCollectionChanged;
        _selectedItems = value;
        if (value != null)
            _selectedItems.CollectionChanged += SelectedItemsCollectionChanged;
        OnPropertyChanged(nameof(SelectedItems));
    }
}
private void SelectedItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
    OnPropertyChanged(nameof(SelectedItems));
}

About

Listview Popup with multiselect-feature

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages