Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/TBertuzzi/Xamarin.Forms.MultiSelectListView

:ballot_box_with_check: Select multiple rows in a listview with xamarin.forms
https://github.com/TBertuzzi/Xamarin.Forms.MultiSelectListView

android control ios nuget nuget-package xamarin xamarin-forms xamarin-library xamarin-plugin xamarinforms

Last synced: 29 days ago
JSON representation

:ballot_box_with_check: Select multiple rows in a listview with xamarin.forms

Awesome Lists containing this project

README

        

# Xamarin.Forms.MultiSelectListView

Select multiple rows in a listview with xamarin.forms.

By default the listview control lets you only select one row at a time. The MultiSelectListView control uses a modified ObservableCollection to mark which rows have been selected.

You can use any image to mark the selected row.

###### This is the component, works on iOS and Android.

![](https://raw.githubusercontent.com/TBertuzzi/Xamarin.Forms.MultiSelectListView/master/Resources/select.png)

**NuGet**

|Name|Info|
| ------------------- | :------------------: |
|MultiSelectListView|[![NuGet](https://buildstats.info/nuget/Xamarin.Forms.MultiSelectListView)](https://www.nuget.org/packages/Xamarin.Forms.MultiSelectListView/)|
|Build status|[![Build status](https://ci.appveyor.com/api/projects/status/github/TBertuzzi/xamarin-forms-multiselectlistview?branch=master&svg=true)](https://ci.appveyor.com/project/ThiagoBertuzzi/xamarin-forms-multiselectlistview)|

**Build History**

[![Build history](https://buildstats.info/appveyor/chart/ThiagoBertuzzi/xamarin-forms-multiselectlistview?buildCount=33)](https://ci.appveyor.com/project/ThiagoBertuzzi/xamarin-forms-multiselectlistview/history)

**Platform Support**

MultiSelectListView is a .NET Standard 2.0 library.Its only dependency is the Xamarin.Forms

## Setup / Usage

Basically the key is to use the MultiSelectObservableCollection instead of the conventional ObservableCollection.

```csharp

public MultiSelectObservableCollection Users { get; }

```

The "IsSelected" property notifies when an object has been selected.

in the Xaml file we must declare our control xmlns: lv = "clr-namespace: Xamarin.Forms.MultiSelectListView; assembly = Xamarin.Forms.MultiSelectListView", for example .

Then use the new MultiSelect.Enable property to enable the multiple selection in the listview.

we must use the SelectableCell that contains the property to inform the icon of the selection

```csharp













```

## SelectedItemBehavior

SelectedItemBehavior to execute the command when the SelectedItem event occurs in ListView. Pass the item selected in ListView to Command.

Based on SelectedItemBehavior by [Atsushi Nakamura](https://github.com/nuitsjp) (https://github.com/nuitsjp/Xamarin.Forms.BehaviorsPack).

If ClearSelected property is true, SelectedItem property of ListView is cleared after command execution. Default ClearSelected property value is true.

You can use the object of the selected line

```csharp



```

Or specify the property you want to pass as a parameter

```csharp


```

The complete example can be downloaded here: https://github.com/TBertuzzi/Xamarin.Forms.MultiSelectListView/tree/master/MultiSelectListViewSample