18

A Drag And Drop Performant CollectionView for MAUI

 1 year ago
source link: https://www.sharpnado.com/collectionview-maui/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

A Drag And Drop Performant CollectionView for MAUI

Jean-Marie Alfonsi

Feb 1, 2023 • 2 min read
A Drag And Drop Performant CollectionView for MAUI

I finally ported sharpnado's xamarin.forms collection view to dotnet MAUI \o/

logo_maui.png Sharpnado's MAUI CollectionView on Github
Sharpnado.CollectionView.Maui.svg
  • Performance oriented
  • Horizontal, Grid, Carousel or Vertical layout
  • Header, Footer and GroupHeader
  • Reveal custom animations
  • Drag and Drop
  • Column count
  • Infinite loading with Paginator component
  • Snapping on first or middle element
  • Padding and item spacing
  • Handles NotifyCollectionChangedAction Add, Remove and Reset actions
  • View and data template recycling
  • RecyclerView on Android
  • UICollectionView on iOS
0:00
/0:14

Installation

  • In Core project, in MauiProgram.cs:
public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    builder
        .UseMauiApp()
        .UseSharpnadoCollectionView(loggerEnabled: false);
}

Usage

<!--  As a Grid  -->
<sho:GridView
    x:Name="HorizontalListView"
    CollectionPadding="30"
    ColumnCount="3"
    EnableDragAndDrop="True"
    HeightRequest="390"
    HorizontalOptions="Fill"
    ItemHeight="110"
    ItemsSource="{Binding Logo, Mode=OneTime}" />

<!--  As a List with groups  -->
<sho:CollectionView
    CollectionLayout="Vertical"
    CollectionPadding="0,30,0,30"
    CurrentIndex="{Binding CurrentIndex}"
    ItemHeight="120"
    ItemTemplate="{StaticResource HeaderFooterGroupingTemplateSelector}"
    ItemsSource="{Binding SillyPeople}"
    ScrollBeganCommand="{Binding OnScrollBeginCommand}"
    ScrollEndedCommand="{Binding OnScrollEndCommand}"
    TapCommand="{Binding TapCommand}" />

<!--  As a carousel -->
<sho:CarouselView />

<!--  As a HorizontalListView -->
<sho:HorizontalListView />

Please find all the available documentation and a full maui app sample here:

e9082fc7-f115-457c-8fe5-db7d67ed1a4f

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK