Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/tbertuzzi/bertuzzi.maui.multiselectlistview

☑️ Select multiple rows in a listview with MAUI
https://github.com/tbertuzzi/bertuzzi.maui.multiselectlistview

android ios maui maui-apps maui-listview xamarin

Last synced: 3 months ago
JSON representation

☑️ Select multiple rows in a listview with MAUI

Awesome Lists containing this project

README

        

# Bertuzzi.MAUI.MultiSelectListView

Select multiple rows in a listview with .net MAUI.

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://github.com/TBertuzzi/Bertuzzi.MAUI.MultiSelectListView/blob/main/Resources/select.png?raw=true)

**NuGet**

|Name|Info|
| ------------------- | :------------------: |
|Bertuzzi.MAUI.MultiSelectListView|[![NuGet](https://buildstats.info/nuget/Bertuzzi.MAUI.MultiSelectListView)](https://www.nuget.org/packages/Bertuzzi.MAUI.MultiSelectListView/)|

**Platform Support**

MultiSelectListView is a .NET MAUI library.

## 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:Bertuzzi.MAUI.MultiSelectListView;assembly=Bertuzzi.MAUI.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/Bertuzzi.MAUI.MultiSelectListView/tree/main/MauiMultiSelectListViewSample