Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/tbertuzzi/bertuzzi.maui.multiselectlistview
- Owner: TBertuzzi
- Created: 2022-10-27T17:55:14.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-27T19:26:26.000Z (about 2 years ago)
- Last Synced: 2024-10-06T10:09:01.451Z (4 months ago)
- Topics: android, ios, maui, maui-apps, maui-listview, xamarin
- Language: C#
- Homepage:
- Size: 174 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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