All Projects → TBertuzzi → Xamarin.Forms.MultiSelectListView

TBertuzzi / Xamarin.Forms.MultiSelectListView

Licence: other
☑️ Select multiple rows in a listview with xamarin.forms

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Xamarin.Forms.MultiSelectListView

Prototype.Forms.Controls
This sample app contains a random mixture of Xamarin/Xamarin.Forms controls, views, and functionality snippets that I've created.
Stars: ✭ 21 (-65.57%)
Mutual labels:  xamarin-forms, xamarin-plugin, xamarin-library, xamarinforms
XamarinForms.VisualDebug
A library and client app to view the visual heirarchy of your Xamarin app pages as an interactive tree diagram at runtime
Stars: ✭ 22 (-63.93%)
Mutual labels:  xamarin-forms, xamarin-library, xamarinforms
Xamarin.forms.breadcrumb
This is a breadcrumb navigation control that is complete automatic and uses the Navigation stack and page titles to generate the breadcrumbs.
Stars: ✭ 130 (+113.11%)
Mutual labels:  control, nuget, xamarin-forms
ButtonCirclePlugin
Circle Buttons with icon for your Xamarin.Forms Applications
Stars: ✭ 96 (+57.38%)
Mutual labels:  nuget, xamarin-forms, xamarin-plugin
EntryCustomReturnPlugin
Xamarin.Forms Plugin to customize the Xamarin.Forms.Entry Keyboard Return Button
Stars: ✭ 81 (+32.79%)
Mutual labels:  nuget, xamarin-forms, xamarin-plugin
XamarinClipboardPlugin
Cross Platform Clipboard access for Xamarin
Stars: ✭ 24 (-60.66%)
Mutual labels:  xamarin-forms, xamarin-plugin, xamarin-library
XamarinFormsPinView
PIN keyboard for Xamarin.Forms.
Stars: ✭ 83 (+36.07%)
Mutual labels:  xamarin-forms, xamarin-plugin, xamarin-library
XamarinHosting
Xamarin Forms Generic Host implementation for Microsoft.Extensions.Hosting.
Stars: ✭ 19 (-68.85%)
Mutual labels:  nuget, xamarin-forms, xamarin-library
VersionTrackingPlugin
Version Tracking Plugin for Xamarin and Windows
Stars: ✭ 62 (+1.64%)
Mutual labels:  nuget, xamarin-forms, xamarin-plugin
Xxamarin
Repositório com ✨ 141 Exemplos de Implementações e 📦 13 Pacotes de Xamarin
Stars: ✭ 68 (+11.48%)
Mutual labels:  nuget, xamarin-forms
Xamarin.plugins
Cross-platform Native API Access from Shared Code!
Stars: ✭ 1,176 (+1827.87%)
Mutual labels:  nuget, xamarin-forms
Latestversionplugin
LatestVersion Plugin for Xamarin and Windows apps
Stars: ✭ 99 (+62.3%)
Mutual labels:  nuget, xamarin-forms
Xamarinmediamanager
Cross platform Xamarin plugin to play and control Audio and Video
Stars: ✭ 647 (+960.66%)
Mutual labels:  nuget, xamarin-forms
Xamarin.forms.inputkit
CheckBox, Radio Button, Labeled Slider, Dropdowns etc.
Stars: ✭ 372 (+509.84%)
Mutual labels:  nuget, xamarin-forms
vscode-npm-gui
vscode nuget package manager gui https://marketplace.visualstudio.com/items?itemName=aliasadidev.nugetpackagemanagergui
Stars: ✭ 36 (-40.98%)
Mutual labels:  nuget, nuget-package
Mvvmcross
The .NET MVVM framework for cross-platform solutions, including Xamarin.iOS, Xamarin.Android, Windows and Mac.
Stars: ✭ 3,594 (+5791.8%)
Mutual labels:  nuget, xamarin-forms
Plugin.audiorecorder
Audio Recorder plugin for Xamarin and Windows
Stars: ✭ 140 (+129.51%)
Mutual labels:  nuget, xamarin-forms
Multilingualplugin
Multilingual Plugin for Xamarin and Windows
Stars: ✭ 99 (+62.3%)
Mutual labels:  nuget, xamarin-forms
Krypton-Toolkit-Suite-Extended-NET-5.470
An extension to the Krypton Toolkit suite of controls for .NET framework 4.7
Stars: ✭ 51 (-16.39%)
Mutual labels:  nuget, nuget-package
ColorPicker
Customizable Color Picker control for WPF
Stars: ✭ 57 (-6.56%)
Mutual labels:  control, nuget

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.

NuGet

Name Info
MultiSelectListView NuGet
Build status Build status

Build History

Build 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.

public MultiSelectObservableCollection<User> 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

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:MultiSelectListViewSample"
             x:Class="MultiSelectListViewSample.MainPage"
            xmlns:lv="clr-namespace:Xamarin.Forms.MultiSelectListView;assembly=Xamarin.Forms.MultiSelectListView" Padding="0,20,0,0">

    <StackLayout>
        <ListView x:Name="lvwUsers" 
            HasUnevenRows="true"
            SeparatorVisibility="Default" 
            ItemsSource="{Binding Users}"
                  lv:MultiSelect.Enable="true">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <lv:SelectableCell x:Name="SelectableCell">

                        <lv:SelectableCell.CheckView>
                            <Image Source="select.png" WidthRequest="30" HeightRequest="30"></Image>
                        </lv:SelectableCell.CheckView>

                        <lv:SelectableCell.DataView>
                            <StackLayout Orientation="Vertical" Padding="20,0,20,0">
                                <Label Text="{Binding Name}" FontSize="17" ></Label>
                            </StackLayout>
                        </lv:SelectableCell.DataView>

                    </lv:SelectableCell>

                </DataTemplate>
            </ListView.ItemTemplate>

        </ListView>
    </StackLayout>

</ContentPage>



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/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

  <ListView.Behaviors>
        <lv:SelectedItemBehavior Command="{Binding DisplayNameCommand}"/>
  </ListView.Behaviors>

Or specify the property you want to pass as a parameter

  <ListView.Behaviors>
       <lv:SelectedItemBehavior Command="{Binding DisplayNameCommand}" PropertyName="Name"/
  </ListView.Behaviors>

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].