MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfListView

    Show / Hide Table of Contents

    Class SfListView

    SfListView control renders a set of data items with different layouts and orientations. Data can be grouped, sorted, and filtered with ease.

    Inheritance
    System.Object
    SfView
    SfListView
    Implements
    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<Microsoft.Maui.IView>
    System.Collections.Generic.ICollection<Microsoft.Maui.IView>
    System.Collections.Generic.IEnumerable<Microsoft.Maui.IView>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.IVisualTreeElement
    Inherited Members
    SfView.OnDraw(ICanvas, RectF)
    SfView.OnBindingContextChanged()
    SfView.MeasureOverride(Double, Double)
    SfView.ArrangeOverride(Rect)
    SfView.OnMeasure(Double, Double)
    SfView.OnHandlerChanged()
    SfView.IDrawableLayout.InvalidateDrawable()
    SfView.Children
    SfView.ClipToBounds
    SfView.Padding
    SfView.IDrawableLayout.DrawingOrder
    Namespace: Syncfusion.Maui.ListView
    Assembly: Syncfusion.Maui.ListView.dll
    Syntax
    public class SfListView : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, IVisualTreeElement, IKeyboardListener
    Examples

    The following example demonstrates how to initialize and use the SfListView.

    using System.ComponentModel;
    using Syncfusion.Maui.ListView;
    using Microsoft.Maui.Controls;
    

    namespace BookInfo {

    class BookInfo {

    public string BookName { get; set; } public string BookAuthor { get; set; }

    public BookInfo(string bookName, string bookAuthor) { BookName = bookName; BookAuthor = bookAuthor; }

    }

    class BookInfoMainPage : ContentPage {

    public BookInfoMainPage() {

    // Define some data. List bookInfo = new List { new BookInfo("Xamarin.Forms", " by Derek Jensen "), new BookInfo("Object-Oriented Programming in C#", "by Sander Rossel"), new BookInfo("iOS Succinctly", "by Ryan Hodson"), new BookInfo("Android Programming", "by Ryan Hodson"), };

    // Initializes the SfListView SfListView listView = new SfListView { // Source of the data ItemsSource = bookInfo,

    // Define the template for displaying each item ItemTemplate = new DataTemplate(() => { // Create a view with bindings for displaying each property. Label bookNameLabel = new Label() { FontSize = 18}; bookNameLabel.SetBinding(Label.TextProperty, "BookName");

    Label bookAuthorLabel = new Label() { FontSize = 12 }; bookAuthorLabel.SetBinding(Label.TextProperty, "BookAuthor");

    // returns a ViewCell. return new ViewCell { View = new StackLayout { Children = { bookNameLabel, bookAuthorLabel } } }; }) };

    this.Content = listView; } } }

    Constructors

    SfListView()

    Initializes a new instance of the SfListView class.

    Declaration
    public SfListView()

    Fields

    AllowGroupExpandCollapseProperty

    Identifies the AllowGroupExpandCollapse bindable property.

    Declaration
    public static readonly BindableProperty AllowGroupExpandCollapseProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    AllowSwipingProperty

    Identifies the AllowSwiping bindable property.

    Declaration
    public static readonly BindableProperty AllowSwipingProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    AutoFitModeProperty

    Identifies the AutoFitMode bindable property.

    Declaration
    public static readonly BindableProperty AutoFitModeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    CachingStrategyProperty

    Identifies the CachingStrategy bindable property.

    Declaration
    public static readonly BindableProperty CachingStrategyProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    CanMaintainScrollPositionProperty

    Identifies the CanMaintainScrollPosition bindable property.

    Declaration
    public static readonly BindableProperty CanMaintainScrollPositionProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindableProperty is read-only.

    CurrentItemProperty

    Identifies the CurrentItem bindable property.

    Declaration
    public static readonly BindableProperty CurrentItemProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    DataSourceProperty

    Identifies the DataSource bindable property.

    Declaration
    public static readonly BindableProperty DataSourceProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    EmptyViewProperty

    Identifies the EmptyView bindable property.

    Declaration
    public static readonly BindableProperty EmptyViewProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    EmptyViewTemplateProperty

    Identifies the EmptyViewTemplate bindable property.

    Declaration
    public static readonly BindableProperty EmptyViewTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    EndSwipeTemplateProperty

    Identifies the EndSwipeTemplate bindable property.

    Declaration
    public static readonly BindableProperty EndSwipeTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    FooterSizeProperty

    Identifies the FooterSize bindable property.

    Declaration
    public static readonly BindableProperty FooterSizeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    FooterTemplateProperty

    Identifies the FooterTemplate bindable property.

    Declaration
    public static readonly BindableProperty FooterTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    GroupHeaderSizeProperty

    Identifies the GroupHeaderSize bindable property.

    Declaration
    public static readonly BindableProperty GroupHeaderSizeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    GroupHeaderTemplateProperty

    Identifies the GroupHeaderTemplate bindable property.

    Declaration
    public static readonly BindableProperty GroupHeaderTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    HeaderSizeProperty

    Identifies the HeaderSize bindable property.

    Declaration
    public static readonly BindableProperty HeaderSizeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    HeaderTemplateProperty

    Identifies the HeaderTemplate bindable property.

    Declaration
    public static readonly BindableProperty HeaderTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    IsLazyLoadingProperty

    Identifies the IsLazyLoading bindable property.

    Declaration
    public static readonly BindableProperty IsLazyLoadingProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    IsScrollingEnabledProperty

    Identifies the IsScrollingEnabled bindable property.

    Declaration
    public static readonly BindableProperty IsScrollingEnabledProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    IsStickyFooterProperty

    Identifies the IsStickyFooter bindable property.

    Declaration
    public static readonly BindableProperty IsStickyFooterProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    IsStickyGroupHeaderProperty

    Identifies the IsStickyGroupHeader bindable property.

    Declaration
    public static readonly BindableProperty IsStickyGroupHeaderProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    IsStickyHeaderProperty

    Identifies the IsStickyHeader bindable property.

    Declaration
    public static readonly BindableProperty IsStickyHeaderProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemSizeProperty

    Identifies the ItemSize bindable property.

    Declaration
    public static readonly BindableProperty ItemSizeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemsLayoutProperty

    Identifies the ItemsLayout bindable property.

    Declaration
    public static readonly BindableProperty ItemsLayoutProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemSpacingProperty

    Identifies the ItemSpacing bindable property.

    Declaration
    public static readonly BindableProperty ItemSpacingProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemsSourceChangeCachingStrategyProperty

    Identifies the ItemsSourceChangeCachingStrategy bindable property.

    Declaration
    public static readonly BindableProperty ItemsSourceChangeCachingStrategyProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemsSourceProperty

    Identifies the ItemsSource bindable property.

    Declaration
    public static readonly BindableProperty ItemsSourceProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemTemplateProperty

    Identifies the ItemTemplate bindable property.

    Declaration
    public static readonly BindableProperty ItemTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LoadMoreCommandParameterProperty

    Identifies the LoadMoreCommandParameter bindable property.

    Declaration
    public static readonly BindableProperty LoadMoreCommandParameterProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LoadMoreCommandProperty

    Identifies the LoadMoreCommand bindable property.

    Declaration
    public static readonly BindableProperty LoadMoreCommandProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LoadMoreOptionProperty

    Identifies LoadMoreOption bindable property.

    Declaration
    public static readonly BindableProperty LoadMoreOptionProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LoadMorePositionProperty

    Identifies LoadMorePosition bindable property.

    Declaration
    public static readonly BindableProperty LoadMorePositionProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LoadMoreTemplateProperty

    Identifies the LoadMoreTemplate bindable property.

    Declaration
    public static readonly BindableProperty LoadMoreTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LongPressCommandParameterProperty

    Identifies the LongPressCommandParameter bindable property.

    Declaration
    public static readonly BindableProperty LongPressCommandParameterProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    LongPressCommandProperty

    Identifies the LongPressCommand bindable property.

    Declaration
    public static readonly BindableProperty LongPressCommandProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    OrientationProperty

    Identifies the Orientation bindable property.

    Declaration
    public static readonly BindableProperty OrientationProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ScrollBarVisibilityProperty

    Identifies the ScrollBarVisibility bindable property.

    Declaration
    public static readonly BindableProperty ScrollBarVisibilityProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectedItemProperty

    Identifies the SelectedItem bindable property.

    Declaration
    public static readonly BindableProperty SelectedItemProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectedItemsProperty

    Identifies the SelectedItems bindable property.

    Declaration
    public static readonly BindableProperty SelectedItemsProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectedItemTemplateProperty

    Identifies the SelectedItemTemplate bindable property.

    Declaration
    public static readonly BindableProperty SelectedItemTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectionBackgroundProperty

    Identifies the SelectionBackground bindable property.

    Declaration
    public static readonly BindableProperty SelectionBackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectionChangedCommandParameterProperty

    Identifies the SelectionChangedCommandParameter bindable property.

    Declaration
    public static readonly BindableProperty SelectionChangedCommandParameterProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectionChangedCommandProperty

    Identifies the SelectionChangedCommand bindable property.

    Declaration
    public static readonly BindableProperty SelectionChangedCommandProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectionGestureProperty

    Identifies the SelectionGesture bindable property.

    Declaration
    public static readonly BindableProperty SelectionGestureProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SelectionModeProperty

    Identifies the SelectionMode bindable property.

    Declaration
    public static readonly BindableProperty SelectionModeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    StartSwipeTemplateProperty

    Identifies the StartSwipeTemplate bindable property.

    Declaration
    public static readonly BindableProperty StartSwipeTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    StickyFooterPositionProperty

    Identifies the StickyFooterPosition bindabe property.

    Declaration
    public static readonly BindableProperty StickyFooterPositionProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    SwipeOffsetProperty

    Identifies the SwipeOffset bindable property.

    Declaration
    public static readonly BindableProperty SwipeOffsetProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    SwipeThresholdProperty

    Identifies the SwipeThreshold bindable property.

    Declaration
    public static readonly BindableProperty SwipeThresholdProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    TapCommandParameterProperty

    Identifies the TapCommandParameter bindable property.

    Declaration
    public static readonly BindableProperty TapCommandParameterProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    TapCommandProperty

    Identifies the TapCommand bindable property.

    Declaration
    public static readonly BindableProperty TapCommandProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    Properties

    AllowGroupExpandCollapse

    Gets or sets a value indicating whether to allow expanding and collapsing of groups for ListViewGroupHeaderItem.

    Declaration
    public bool AllowGroupExpandCollapse { get; set; }
    Property Value
    Type Description
    System.Boolean

    true If allow expand and collapse groups; otherwise, false.

    Examples
    SfListView listView = new SfListView();
    listView.AllowGroupExpandCollapse = true;
    See Also
    GroupDescriptor
    GroupExpanding
    GroupExpanded
    GroupCollapsing
    GroupCollapsed
    GroupHeaderTemplate
    GroupHeaderSize
    IsStickyGroupHeader

    AllowSwiping

    Gets or sets a value that determines whether the user can swipe items in the ListView to reveal actions.

    Declaration
    public bool AllowSwiping { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples

    The default value is false.

     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True">
     </syncfusion:SfListView>
    See Also
    StartSwipeTemplate
    EndSwipeTemplate
    SwipeOffset
    SwipeThreshold
    SwipeStarting
    SwipeEnded
    Swiping
    SwipeReset

    AutoFitMode

    Gets or sets the value that indicates whether SfListView will AutoFitMode the items based on its content.

    Declaration
    public AutoFitMode AutoFitMode { get; set; }
    Property Value
    Type Description
    AutoFitMode
    Examples
    SfListView listView = new SfListView();
    listView.AutoFitMode = AutoFitMode.Height;
    See Also
    ItemSize
    QueryItemSize
    HeaderSize
    GroupHeaderSize
    FooterSize

    CachingStrategy

    Gets or sets the caching strategies of data template when re-using listview items.

    Declaration
    public CachingStrategy CachingStrategy { get; set; }
    Property Value
    Type Description
    CachingStrategy

    The default value is RecycleTemplatewhere that data templates get re-used while data object associated with listview item gets changed. While scrolling binding contexts of data template object get updated and re-used. The data templates objects that are selected by a Microsoft.Maui.Controls.DataTemplateSelector are cached by the data template type and re-used.

    See Also
    ItemsSourceChangeCachingStrategy
    ItemsSource
    Source

    CanMaintainScrollPosition

    Gets or sets a value indicating whether ScrollPosition of the SfListView should be maintained when ItemsSource is changed.The default value is false.

    Declaration
    public bool CanMaintainScrollPosition { get; set; }
    Property Value
    Type Description
    System.Boolean

    CurrentItem

    Gets or sets the current selected item.

    Declaration
    public object CurrentItem { get; set; }
    Property Value
    Type Description
    System.Object

    The current item.

    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.ItemsSource = viewModel.BookInfo;
    listView.CurrentItem = viewModel.BookInfo[2];
    See Also
    SelectionChanged
    SelectionChanging
    SelectionChangedCommand
    SelectionMode
    SelectedItem
    SelectionGesture
    SelectedItems

    DataSource

    Gets or sets the for data operations like sorting, filtering, and grouping.

    Declaration
    public DataSource DataSource { get; set; }
    Property Value
    Type Description
    DataSource
    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    DataSource dataSource = new DataSource();
    dataSource.SortDescriptors.Add(new SortDescriptor()
    {
      PropertyName = "ContactName",
      Direction = ListSortDirection.Ascending,
    });
    dataSource.Source = viewModel.BookInfo;
    listView.DataSource = dataSource;
    See Also
    GroupDescriptor
    SortDescriptor
    Filter

    EmptyView

    Gets or sets the content or view that will be displayed when there are no items in SfListView

    Declaration
    public object EmptyView { get; set; }
    Property Value
    Type Description
    System.Object

    EmptyViewTemplate

    Gets or sets the data template for EmptyView

    Declaration
    public DataTemplate EmptyViewTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
    ViewModel viewModel = new ViewModel();
    SfListView listView = new SfListView();
    listView.ItemsSource = viewModel.InboxInfo;
    listView.EmptyViewTemplate = new DataTemplate(() =>
    {
       var grid = new Grid();
       grid.BackgroundColor = Color.FromHex("#4CA1FE");
       var emptyViewLabel = new Label
       {
           BackgroundColor = Color.White,
           FontSize = 18,
           FontAttributes = FontAttributes.Bold,
           Text = "No Items"
       };
    
       grid.Children.Add(emptyViewLabel);
    
       return grid;
    });

    EndSwipeTemplate

    Gets or sets the template that is shown when a user swipes an item in the SfListView to Right in vertical orientation or Down in horizontal orientation.

    Declaration
    public DataTemplate EndSwipeTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True">
          <syncfusion:SfListView.EndSwipeTemplate>
                   <DataTemplate x:Name="EndSwipeTemplate">
                       <Grid>
                           <Grid BackgroundColor = "#009EDA"
                                 HorizontalOptions="Fill"
                                  VerticalOptions="Fill"
                                  Grid.Column="0">
                            <Grid VerticalOptions = "Center"
                                  HorizontalOptions="Center">
                                    <Image Grid.Column="0"
                                          Grid.Row= "0"
                                          BackgroundColor= "Transparent"
                                          HeightRequest= "35"
                                          WidthRequest= "35"
                                          Source= "Delete.png"/>
    		            </Grid>
    	        	</Grid>
    	        </Grid>
            </DataTemplate>
        </syncfusion:SfListView.EndSwipeTemplate>
     </syncfusion:SfListView>
    See Also
    StartSwipeTemplate

    FooterSize

    Gets or sets the height (for vertical orientation) or width (for horizontal orientation) of the footer. The default value is 40d.

    Declaration
    public double FooterSize { get; set; }
    Property Value
    Type Description
    System.Double
    Examples
    SfListView listView = new SfListView();
    listView.FooterSize = 70;
    See Also
    ItemSize
    AutoFitMode
    GroupHeaderSize
    HeaderSize
    QueryItemSize

    FooterTemplate

    Gets or sets the footer template for SfListView.

    Declaration
    public DataTemplate FooterTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
    ViewModel viewModel = new ViewModel();
    SfListView listView = new SfListView();
    listView.ItemsSource = viewModel.InboxInfo;
    listView.FooterTemplate = new DataTemplate(() =>
    {
       var grid = new Grid();
       grid.BackgroundColor = Color.FromHex("#4CA1FE");
       var footerLabel = new Label
       {
           BackgroundColor = Color.White,
           FontSize = 18,
           FontAttributes = FontAttributes.Bold,
           Text = "Footer"
       };
    
       grid.Children.Add(footerLabel);
    
       return grid;
    });

    GroupHeaderSize

    Gets or sets the height (for vertical orientation) or width (for horizontal orientation) of the group header. The default value is 36d.

    Declaration
    public double GroupHeaderSize { get; set; }
    Property Value
    Type Description
    System.Double
    Examples
    SfListView listView = new SfListView();
    listView.GroupHeaderSize = 70;
    See Also
    ItemSize
    AutoFitMode
    QueryItemSize
    HeaderSize
    FooterSize

    GroupHeaderTemplate

    Gets or sets the Microsoft.Maui.Controls.DataTemplate for the group headers of SfListView.

    Declaration
    public DataTemplate GroupHeaderTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
    SfListView listView = new SfListView();
    listView.GroupHeaderTemplate = new DataTemplate(() =>
    {
       var grid = new Grid();
    
       var label1 = new Label();
       label1.SetBinding(Label.TextProperty, new Binding("Key"));
    
       var label2 = new Label();
       Binding binding = new Binding("Items");
       binding.Converter = new Converter();
       label2.SetBinding(Label.TextProperty, binding);
    
       grid.Children.Add(label1);
       grid.Children.Add(label2, 1, 0);
    
       return grid;
    });
    See Also
    ItemTemplate
    HeaderTemplate
    FooterTemplate

    HeaderSize

    Gets or sets the height (for vertical orientation) or width (for horizontal orientation) of the header. The default value is 40d.

    Declaration
    public double HeaderSize { get; set; }
    Property Value
    Type Description
    System.Double
    Examples
    SfListView listView = new SfListView();
    listView.HeaderSize = 70;
    See Also
    ItemSize
    AutoFitMode
    GroupHeaderSize
    QueryItemSize
    FooterSize

    HeaderTemplate

    Gets or sets a header template for SfListView.

    Declaration
    public DataTemplate HeaderTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
    ViewModel viewModel = new ViewModel();
    SfListView listView = new SfListView();
    listView.ItemsSource = viewModel.InboxInfo;
    listView.HeaderTemplate = new DataTemplate(() =>
    {
       var grid = new Grid();
       grid.BackgroundColor = Color.FromHex("#4CA1FE");
       var headerLabel = new Label
       {
           BackgroundColor = Color.White,
           FontSize = 18,
           FontAttributes = FontAttributes.Bold,
           Text = "Inbox"
       };
    
       grid.Children.Add(headerLabel);
    
       return grid;
    });

    IsLazyLoading

    Gets or sets a value indicating whether list view is busy in loading more items. If it is true, the load more indicators will be displayed until it sets to false.

    Declaration
    public bool IsLazyLoading { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.ItemsSource = viewModel.Products;
    listView.LoadMoreOption = LoadMoreOption.Manual;
    listView.LoadMoreCommand = viewModel.LoadMoreItemsCommand;
    listView.SetBinding(SfListView.IsLazyLoadingProperty, new Binding("IsLazyLoading"));
    
    //ViewModel.cs
    private bool isLazyLoading;
    public bool IsLazyLoading
    {
        get { return isLazyLoading; }
        set
        {
            this.isLazyLoading = value;
            RaisePropertyChanged("IsLazyLoading");
        }
    }
    
    LoadMoreItemsCommand = new Command<object>(LoadMoreItems, CanLoadMoreItems);
    
    private bool CanLoadMoreItems(object obj)
    {
        if (Products.Count >= totalItems)
            return false;
        return true;
    }
    
    private async void LoadMoreItems(object obj)
    {
        var listView = obj as Syncfusion.Maui.ListView.SfListView;
        IsLazyLoading = true;
        await Task.Delay(2500);
        var index = Products.Count;
        var count = index + 3 >= totalItems ? totalItems - index : 3;
        AddProducts(index, count);
        IsLazyLoading = false;
    }
    
    private void AddProducts(int index, int count)
    {
       var name = Names[0];
       var p = new Product()
       {
           Name = name,
           Weight = Weights[0],
           Price = Prices[0],
           Image = ImageSource.FromResource("LoadMoreUG.LoadMore." + name.Replace(" ", string.Empty) + ".jpg")
       };
    
       Products.Add(p);
    }
    See Also
    LoadMoreTemplate
    LoadMorePosition
    LoadMoreOption
    LoadMoreCommand

    IsScrollingEnabled

    Gets or sets a value indicating whether the scrolling is enabled or disabled for listview.

    Declaration
    public bool IsScrollingEnabled { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    if IsScrollingEnabled is false then ListView will be rendering all its content with full height. Therefore, listView content will not be viewable without external ScrollView if they have content to be loaded that exceeds view size. if IsScrollingEnabled is true then ListView will make its content appropriate to View Size and reuse the items during the scrolling process.

    IsStickyFooter

    Gets or sets a value indicating whether to display the sticky footer or scrollable footer.

    Declaration
    public bool IsStickyFooter { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    SfListView listView = new SfListView();
    listView.IsStickyFooter = true;
    See Also
    IsStickyHeader
    IsStickyGroupHeader

    IsStickyGroupHeader

    Gets or sets a value indicating whether to display the sticky group header or scrollable group header.

    Declaration
    public bool IsStickyGroupHeader { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    If true and AutoFitMode is 'Height' or 'DynamicHeight', sticky group header panning experience will not be smooth or item's layout won't work as expected. You can enable smooth experience, Set same size for all group header items by handling the QueryItemSize event.

    Examples
    SfListView listView = new SfListView();
    listView.IsStickyGroupHeader = true;
    See Also
    IsStickyFooter
    IsStickyHeader

    IsStickyHeader

    Gets or sets a value indicating whether to display the sticky header or scrollable header.

    Declaration
    public bool IsStickyHeader { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    SfListView listView = new SfListView();
    listView.IsStickyHeader = true;
    See Also
    IsStickyFooter
    IsStickyGroupHeader

    ItemGenerator

    Gets or sets the ItemGenerator to create or update a ListViewItem.

    Declaration
    public ItemsGenerator ItemGenerator { get; set; }
    Property Value
    Type Description
    ItemsGenerator
    Examples
    SfListView listView = new SfListView();
    listView.ItemGenerator = new ItemGeneratorExt(this.listView);
    
    public class ItemGeneratorExt : ItemGenerator
    {
        public SfListView listView;
    
        public ItemGeneratorExt(SfListView listView) : base(listView)
        {
            this.listView = listView;
        }
    
        protected override ListViewItem OnCreateListViewItem(int itemIndex, ItemType type, object data = null)
        {
            if (type == ItemType.Header)
                return new HeaderItemExt(this.listView);
            return base.OnCreateListViewItem(itemIndex, type, data);
        }
    }
    
    public class HeaderItemExt : HeaderItem
    {
       private SfListView listView;
    
       public HeaderItemExt(SfListView listView)
       {
           this.listView = listView
       }
    
       protected override void OnItemAppearing()
       {
           base.OnItemAppearing();
           this.BackgroundColor = Color.Yellow;
       }
    }

    ItemSize

    Gets or sets the height (for vertical orientation) or width (for horizontal orientation) of the item. The default value is 48d.

    Declaration
    public double ItemSize { get; set; }
    Property Value
    Type Description
    System.Double
    Examples
    SfListView listView = new SfListView();
    listView.ItemSize = 70;
    See Also
    QueryItemSize
    AutoFitMode
    GroupHeaderSize
    HeaderSize
    FooterSize

    ItemsLayout

    Gets or sets the layout definition for SfListView. The default layout is LinearLayout.

    Declaration
    public ListViewLayout ItemsLayout { get; set; }
    Property Value
    Type Description
    ListViewLayout
    Remarks

    The LinearLayout will arrange the items in a single column and the GridLayout will arrange the items in a predefined number of columns.

    Examples
    SfListView listView = new SfListView();
    listView.ItemsLayout = new GridLayout();

    ItemSpacing

    Gets or sets the item spacing between the items.

    Declaration
    public Thickness ItemSpacing { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Thickness
    Examples
    SfListView listView = new SfListView();
    listView.ItemSpacing = new Thickness(0, 5, 5, 0);

    ItemsSource

    Gets or sets the source items to template and display in SfListView.

    Declaration
    public object ItemsSource { get; set; }
    Property Value
    Type Description
    System.Object
    Examples
    ViewModel viewModel = new ViewModel();
    SfListView listView = new SfListView();
    listView.ItemsSource = viewModel.BookInfo;
    See Also
    DataSource
    Source

    ItemsSourceChangeCachingStrategy

    Gets or sets the caching strategies of data templates when re-using listview items.

    Declaration
    public ItemsSourceChangeCachingStrategy ItemsSourceChangeCachingStrategy { get; set; }
    Property Value
    Type Description
    ItemsSourceChangeCachingStrategy

    The default value is RecycleItems where binding contexts of data template object get updated and re-used changing ItemsSource at runtime. The data templates objects that are selected by a Microsoft.Maui.Controls.DataTemplateSelector are cached by the data template type and re-used.

    See Also
    ItemsSource
    Source
    CachingStrategy

    ItemTemplate

    Gets or sets the data template for ListViewItem.

    Declaration
    public DataTemplate ItemTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
    ViewModel viewModel = new ViewModel();
    SfListView listView = new SfListView
    {
       ItemsSource = viewModel.bookInfo,
    

    // Define the template for displaying each item ItemTemplate = new DataTemplate(() => { // Create a view with bindings for displaying each property. Label bookNameLabel = new Label() { FontSize = 18}; bookNameLabel.SetBinding(Label.TextProperty, "BookName");

    Label bookAuthorLabel = new Label() { FontSize = 12 }; bookAuthorLabel.SetBinding(Label.TextProperty, "BookAuthor");

    // returns a ViewCell. return new ViewCell { View = new StackLayout { Children = { bookNameLabel, bookAuthorLabel } } }; }) };

    LoadMoreCommand

    Gets or sets System.Windows.Input.ICommand which will be executed when load more operation is triggered.

    Declaration
    public ICommand LoadMoreCommand { get; set; }
    Property Value
    Type Description
    System.Windows.Input.ICommand
    Examples
    ViewModel viewModel = new ViewModel();
    SfListView listView = new SfListView();
    listView.ItemsSource = viewModel.Products;
    listView.LoadMoreOption = LoadMoreOption.Manual;
    listView.LoadMoreCommand = viewModel.LoadMoreItemsCommand;
    listView.SetBinding(SfListView.IsLazyLoadingProperty, new Binding("IsLazyLoading"));
    
    //ViewModel.cs
    private bool isLazyLoading;
    public bool IsLazyLoading
    {
        get { return isLazyLoading; }
        set
        {
            this.isLazyLoading = value;
            RaisePropertyChanged("IsLazyLoading");
        }
    }
    
    LoadMoreItemsCommand = new Command<object>(LoadMoreItems, CanLoadMoreItems);
    
    private bool CanLoadMoreItems(object obj)
    {
        if (Products.Count >= totalItems)
            return false;
        return true;
    }
    
    private async void LoadMoreItems(object obj)
    {
        var listView = obj as Syncfusion.Maui.ListView.SfListView;
        IsLazyLoading = true;
        await Task.Delay(2500);
        var index = Products.Count;
        var count = index + 3 >= totalItems ? totalItems - index : 3;
        AddProducts(index, count);
        IsLazyLoading = false;
    }
    
    private void AddProducts(int index, int count)
    {
       var name = Names[0];
       var p = new Product()
       {
           Name = name,
           Weight = Weights[0],
           Price = Prices[0]
       };
    
       Products.Add(p);
    }

    LoadMoreCommandParameter

    Gets or sets the parameter for LoadMoreCommand.

    Declaration
    public object LoadMoreCommandParameter { get; set; }
    Property Value
    Type Description
    System.Object
    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.ItemsSource = viewModel.Products;
    listView.LoadMoreOption = LoadMoreOption.Manual;
    listView.LoadMoreCommand = viewModel.LoadMoreItemsCommand;
    listView.SetBinding(SfListView.IsLazyLoadingProperty, new Binding("IsLazyLoading"));
    
    //ViewModel.cs
    private bool isLazyLoading;
    public bool IsLazyLoading
    {
        get { return isLazyLoading; }
        set
        {
            this.isLazyLoading = value;
            RaisePropertyChanged("IsLazyLoading");
        }
    }
    
    LoadMoreItemsCommand = new Command<object>(LoadMoreItems, CanLoadMoreItems);
    
    private bool CanLoadMoreItems(object obj)
    {
        if (Products.Count >= totalItems)
            return false;
        return true;
    }
    
    private async void LoadMoreItems(object obj)
    {
        var listView = obj as Syncfusion.Maui.ListView.SfListView;
        IsLazyLoading = true;
        await Task.Delay(2500);
        var index = Products.Count;
        var count = index + 3 >= totalItems ? totalItems - index : 3;
        AddProducts(index, count);
        IsLazyLoading = false;
    }
    
    private void AddProducts(int index, int count)
    {
       var name = Names[0];
       var p = new Product()
       {
           Name = name,
           Weight = Weights[0],
           Price = Prices[0],
           Image = ImageSource.FromResource("LoadMoreUG.LoadMore." + name.Replace(" ", string.Empty) + ".jpg")
       };
    
       Products.Add(p);
    }

    LoadMoreOption

    Gets or sets the option which determines the behavior of load more items. If it is None, load more support will not be enabled. This is the default value.
    If it is Auto, automatically execute the LoadMoreCommand when list view reaches the scroll end.
    If it is Manual, displays load more button when end reached and execute the LoadMoreCommand when tap on button. For Microsoft.Maui.Controls.ItemsLayoutOrientation.Horizontal, Manual is not supported. For Start, Auto is not supported.

    Declaration
    public LoadMoreOption LoadMoreOption { get; set; }
    Property Value
    Type Description
    LoadMoreOption
    Examples
    SfListView listView = new SfListView();
    listView.LoadMoreOption = LoadMoreOption.Manual;
    See Also
    LoadMoreTemplate
    IsLazyLoading
    LoadMoreCommand
    LoadMorePosition

    LoadMorePosition

    Gets or sets the position which determines where the load more item should be positioned. If it is Start, load more item will be added on the top of the list.
    If it is Start and Microsoft.Maui.Controls.ItemsLayoutOrientation.Horizontal, the load more item will be in the left corner of the list. If it is End, the load more item will be added at the bottom of the list. This is the default value.
    If it is End and Microsoft.Maui.Controls.ItemsLayoutOrientation.Horizontal, the load more item will be in the right corner of the list.

    Declaration
    public LoadMorePosition LoadMorePosition { get; set; }
    Property Value
    Type Description
    LoadMorePosition
    Examples
    SfListView listView = new SfListView();
    listView.LoadMorePosition = LoadMorePosition.Start;
    See Also
    LoadMoreOption
    LoadMoreCommand
    IsLazyLoading
    LoadMoreTemplate

    LoadMoreTemplate

    Gets or sets the Microsoft.Maui.Controls.DataTemplate which will be loaded as a ListViewLoadMoreItem. If it is null, the default load more view will be loaded.

    Declaration
    public DataTemplate LoadMoreTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
    SfListView listView = new SfListView();
    listView.ItemsSource = viewModel.BookInfo;
    listView.LoadMoreTemplate = new DataTemplate(() =>
    {
       var grid = new Grid();
       var label = new Label
       {
           Text = "Click here to Load More Items...",
           FontSize = 20,
           BackgroundColor = Color.AliceBlue,
           HorizontalTextAlignment = TextAlignment.Center,
           VerticalTextAlignment = TextAlignment.Center
       };
       label.SetBinding(Label.IsVisibleProperty, new Binding("IsLazyLoading", BindingMode.Default, new InverseBoolConverter()));
       grid.Children.Add(label);
       return grid;
    });

    LongPressCommand

    Gets or sets System.Windows.Input.ICommand which will be executed when long press on the ListViewItem.

    Declaration
    public ICommand LongPressCommand { get; set; }
    Property Value
    Type Description
    System.Windows.Input.ICommand
    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.LongPressCommand = viewModel.LongPressCommand;
    public class CommandViewModel
    {
      private Command<Object> longPressCommand;
    
      public Command<object> LongPressCommand
      {
          get { return longPressCommand; }
          set { longPressCommand = value; }
      }
    
      public CommandViewModel()
      {
          LongPressCommand = new Command<object>(LongPressCommandMethod);
      }
    
      private void LongPressCommandMethod(object obj)
      {
          if ((obj as Syncfusion.Maui.ListView.ItemLongPressEventArgs).DataItem == viewModel.InboxInfo[3])
              viewModel.InboxInfo.Remove((obj as Syncfusion.Maui.ListView.ItemLongPressEventArgs).DataItem as ListViewInboxInfo);
      }
    }
    See Also
    LongPressCommandParameter
    TapCommand
    SelectionChangedCommand

    LongPressCommandParameter

    Gets or sets the parameter for LongPressCommand.

    Declaration
    public object LongPressCommandParameter { get; set; }
    Property Value
    Type Description
    System.Object
    Remarks

    The default value is ItemLongPressEventArgs.

    See Also
    LongPressCommand

    Orientation

    Gets or sets the orientation for SfListView. The default orientation is vertical.

    Declaration
    public ItemsLayoutOrientation Orientation { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.ItemsLayoutOrientation
    Examples
    SfListView listView = new SfListView();
    listView.Orientation = Orientation.Horizontal;

    ScrollBarVisibility

    Gets or sets a value that indicates whether a vertical (in Microsoft.Maui.Controls.ItemsLayoutOrientation.Vertical orientation) or horizontal (in Microsoft.Maui.Controls.ItemsLayoutOrientation.Horizontal Orientation) scroll bar should be displayed.

    Declaration
    public ScrollBarVisibility ScrollBarVisibility { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.ScrollBarVisibility

    SelectedItem

    Gets or sets the first selected item.

    Declaration
    public object SelectedItem { get; set; }
    Property Value
    Type Description
    System.Object

    The selected item.

    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.ItemsSource = viewModel.BookInfo;
    listView.SelectedItem = viewModel.BookInfo[2];
    See Also
    SelectionChanged
    SelectionChanging
    SelectionChangedCommand
    SelectionMode
    CurrentItem
    SelectionGesture
    SelectedItems

    SelectedItems

    Gets the selected items for selection.

    Declaration
    public ObservableCollection<object> SelectedItems { get; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<System.Object>
    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.ItemsSource = viewModel.Products;
    listView.SelectionMode = SelectionMode.Multiple;
    listView.SelectedItems = viewModel.SelectedItems;
    
    //ViewModel
    public ObservableCollection<object> Products{ get; set; }
    private ObservableCollection<object> selectedItems;
    public ObservableCollection<object> SelectedItems
    {
        get
        {
            return selectedItems;
        }
        set
        {
                selectedItems = value;
            }
        }
    
    public ViewModel()
    {
        this.Products = GenerateItemsSource();
        this.SelectedItems = new ObservableCollection<object>();
        this.SelectedItems.Add(this.Products[1]);
        this.SelectedItems.Add(this.Products[2]);
        this.SelectedItems.Add(this.Products[3]);
    }
    See Also
    SelectionChanged
    SelectionChanging
    SelectionChangedCommand
    SelectionMode
    SelectionGesture
    SelectedItem

    SelectedItemTemplate

    Gets or sets the selected item template for selection.

    Declaration
    public DataTemplate SelectedItemTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
    ViewModel viewModel = new ViewModel();
    SfListView listView = new SfListView();
    listView.ItemsSource = viewModel.BookInfo;
    listView.SelectedItemTemplate = new DataTemplate(() =>
    {
       var grid = new Grid();
       grid.BackgroundColor = Color.FromHex("#4CA1FE");
       var bookNameLabel = new Label
       {
           BackgroundColor = Color.White,
           FontSize = 18,
           FontAttributes = FontAttributes.Bold,
       };
       bookNameLabel.SetBinding(Label.TextProperty, "BookName");
       grid.Children.Add(footerLabel);
    
       return grid;
    });

    SelectionBackground

    Gets or sets the selection background color for the selected item.

    Declaration
    public Brush SelectionBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush
    Examples
    SfListView listView = new SfListView();
    listView.SelectionBackground = Brush.Green;
    See Also
    SelectionChanged
    SelectionChanging
    SelectionChangedCommand
    SelectionMode
    SelectedItem
    CurrentItem
    SelectedItems
    SelectionGesture

    SelectionChangedCommand

    Gets or sets the System.Windows.Input.ICommand to be executed when the selection is changed.

    Declaration
    public ICommand SelectionChangedCommand { get; set; }
    Property Value
    Type Description
    System.Windows.Input.ICommand
    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.SelectionChangedCommand = viewModel.ListViewSelectionChangedCommand;
    
    public class CommandViewModel
    {
        private Command<Object> selectionChangedCommand;
        public Command<object> ListViewSelectionChagedCommand
        {
           get { return selectionChangedCommand; }
           set { selectionChangedCommand = value; }
        }
        public CommandViewModel()
        {
            ListViewSelectionChagedCommand = new Command<object>(SelectionChagedCommandMethod);
        }
        private void SelectionChagedCommandMethod(object obj)
        {
            listView.SelectedItems.Clear();
        }
    }
    See Also
    TapCommand
    LongPressCommand

    SelectionChangedCommandParameter

    Gets or sets the parameter for SelectionChangedCommand.

    Declaration
    public object SelectionChangedCommandParameter { get; set; }
    Property Value
    Type Description
    System.Object
    Remarks

    The default value of SelectionChangedCommandParameter is null. if SelectionChangedCommandParameter is not defined then ItemSelectionChangedEventArgs will be passed as argument.

    SelectionGesture

    Gets or sets the selection gesture for selection.

    Declaration
    public TouchGesture SelectionGesture { get; set; }
    Property Value
    Type Description
    TouchGesture
    Remarks

    By default value, the SelectionGesture is TouchGesture.Tap.

    Examples
    SfListView listView = new SfListView();
    listView.SelectionGesture = TouchGesture.LongPress;
    See Also
    SelectionChanged
    SelectionChanging
    SelectionChangedCommand
    SelectionMode

    SelectionMode

    Gets or sets the selection mode for selection.

    Declaration
    public SelectionMode SelectionMode { get; set; }
    Property Value
    Type Description
    SelectionMode
    Remarks

    By default value, the SelectionMode is SelectionMode.Single.

    Examples
    SfListView listView = new SfListView();
    listView.SelectionMode = SelectionMode.SingleDeselect;
    See Also
    SelectionChanged
    SelectionChanging
    SelectionChangedCommand
    SelectionGesture

    StartSwipeTemplate

    Gets or sets the template that is shown when a user swipes an item in the SfListView to Left in vertical orientation or Up in horizontal orientation.

    Declaration
    public DataTemplate StartSwipeTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate
    Examples
     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True">
          <syncfusion:SfListView.StartSwipeTemplate>
                   <DataTemplate x:Name="StartSwipeTemplate">
                       <Grid>
                           <Grid BackgroundColor = "#009EDA"
                                 HorizontalOptions="Fill"
                                  VerticalOptions="Fill"
                                  Grid.Column="0">
                            <Grid VerticalOptions = "Center"
                                  HorizontalOptions="Center">
                                    <Image Grid.Column="0"
                                          Grid.Row= "0"
                                          BackgroundColor= "Transparent"
                                          HeightRequest= "35"
                                          WidthRequest= "35"
                                          Source= "Favorites.png" />
    		            </Grid >
    	        	</Grid>
    	        </Grid>
            </DataTemplate>
        </syncfusion:SfListView.StartSwipeTemplate>
     </syncfusion:SfListView>
    See Also
    EndSwipeTemplate

    StickyFooterPosition

    Gets or sets a value indicating whether to display the sticky footer inside the body of the ListView when items are less than the body size.

    Declaration
    public ListViewFooterPosition StickyFooterPosition { get; set; }
    Property Value
    Type Description
    ListViewFooterPosition
    Remarks

    This API is applicable when IsStickyFooter is enabled. If the value is 'Default', it will be placed at the end of the ListView and if the value is 'Body', it will be placed inside the body of the ListView when items are less than the body size.

    Examples
    SfListView listView = new SfListView();
    listView.StickyFooterPosition = FooterPosition.Body;
    See Also
    IsStickyFooter
    FooterSize

    SwipeOffset

    Gets or sets the value which specifies the distance that a swiped item will be moved to the side and stay there when it is swiped.

    Declaration
    public double SwipeOffset { get; set; }
    Property Value
    Type Description
    System.Double

    The default value is 100.

    Examples

    To set the SwipeOffset property.

     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True"
                            SwipeOffset="60">
     </syncfusion:SfListView>
    See Also
    SwipeThreshold

    SwipeThreshold

    Gets or sets the value that determines the distance at which a swipe view is considered as stuck or completed when SwipeOffset exceeds the half of the SwipeThreshold value.

    Declaration
    public double SwipeThreshold { get; set; }
    Property Value
    Type Description
    System.Double

    The default value is 40.

    Examples
     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True"
                            SwipeOffset="60"
                            SwipeThreshold="30">
     </syncfusion:SfListView>
    See Also
    SwipeOffset

    TapCommand

    Gets or sets the System.Windows.Input.ICommand which will be executed when tapping the ListViewItem.

    Declaration
    public ICommand TapCommand { get; set; }
    Property Value
    Type Description
    System.Windows.Input.ICommand
    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.TapCommand = viewModel.TappedCommand;
    
    public class CommandViewModel
    {
      private Command<Object> tappedCommand;
    
      public Command<object> TappedCommand
      {
          get { return tappedCommand; }
          set { tappedCommand = value; }
      }
    
      public CommandViewModel()
      {
          TappedCommand = new Command<object>(TappedCommandMethod);
      }
    
      private void TappedCommandMethod(object obj)
      {
          if ((obj as Syncfusion.Maui.ListView.ItemTappedEventArgs).DataItem == viewModel.InboxInfo[0])
              viewModel.InboxInfo.Remove((obj as Syncfusion.Maui.ListView.ItemTappedEventArgs).DataItem as ListViewInboxInfo)
      }
    }
    See Also
    LongPressCommand
    SelectionChangedCommand

    TapCommandParameter

    Gets or sets the parameter for TapCommand.

    Declaration
    public object TapCommandParameter { get; set; }
    Property Value
    Type Description
    System.Object
    Remarks

    The default value is ItemTappedEventArgs.

    See Also
    TapCommand

    Methods

    ArrangeContent(Rect)

    ArrangeContent method.

    Declaration
    protected override Size ArrangeContent(Rect bounds)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Rect bounds

    The bounds.

    Returns
    Type Description
    Microsoft.Maui.Graphics.Size

    It returns the size.

    Overrides
    SfView.ArrangeContent(Rect)

    CollapseAll()

    Collapses all the groups in Groups.

    Declaration
    public void CollapseAll()
    Remarks

    This method collapse all the groups in Groups programmatically.

    CollapseGroup(GroupResult)

    Collapses the specified group.

    Declaration
    public void CollapseGroup(GroupResult group)
    Parameters
    Type Name Description
    GroupResult group

    Specifies the GroupResult to collapse it from view.

    Examples
                 var group = (listview.DataSource.Groups[0] as Group);
                 this.listview.CollapseGroup(group);

    ExpandAll()

    Expands all the groups in Groups.

    Declaration
    public void ExpandAll()
    Remarks

    This method expand all the groups in Groups programmatically.

    ExpandGroup(GroupResult)

    Expands the specified group.

    Declaration
    public void ExpandGroup(GroupResult group)
    Parameters
    Type Name Description
    GroupResult group

    Specifies the GroupResult to expand it from view.

    Examples
                 var group = (listview.DataSource.Groups[0] as Group);
                 this.listview.ExpandGroup(group);

    InvalidateMeasure()

    Method to override invalidate the measure.

    Declaration
    protected override void InvalidateMeasure()

    MeasureContent(Double, Double)

    MeasureContent method.

    Declaration
    protected override Size MeasureContent(double widthConstraint, double heightConstraint)
    Parameters
    Type Name Description
    System.Double widthConstraint

    The width.

    System.Double heightConstraint

    The height.

    Returns
    Type Description
    Microsoft.Maui.Graphics.Size

    It returns the size.

    Overrides
    SfView.MeasureContent(Double, Double)

    OnPropertyChanged(String)

    Need to handle the run time changes of System.ComponentModel.PropertyChangedEventArgs of SfListView.

    Declaration
    protected override void OnPropertyChanged(string propertyName = null)
    Parameters
    Type Name Description
    System.String propertyName

    Represents the property changed event arguments.

    RefreshItem(Int32, Int32, Boolean)

    Helper method to refresh the particular item, range of items or all the items in the listView and also refresh the template.

    Declaration
    public void RefreshItem(int startRowIndex = -1, int endRowIndex = -1, bool canReload = false)
    Parameters
    Type Name Description
    System.Int32 startRowIndex

    Indicates that the start row index to refresh.

    System.Int32 endRowIndex

    Indicates that the end row index to refresh.

    System.Boolean canReload

    Indicates whether to refresh the template or not.

    RefreshView()

    Refreshes the view.

    Declaration
    public void RefreshView()

    ResetSwipeItem(Boolean)

    Resets the swiping and moves the swiped ListViewItem to its default position.

    Declaration
    public void ResetSwipeItem(bool canAnimate = false)
    Parameters
    Type Name Description
    System.Boolean canAnimate

    Indicates whether animate the ListViewItem.

    ScrollTo(Double, Boolean)

    Scrolls the SfListView item into given position.

    Declaration
    public void ScrollTo(double position, bool disableAnimation = false)
    Parameters
    Type Name Description
    System.Double position

    The position based on Orientation to scroll.

    System.Boolean disableAnimation

    True to disable scroll animation while changing the view; otherwise, false. The default is false.

    Examples
    SfListView listView = new SfListView();
    listView.ScrollTo(1000, true);

    ScrollTo(Object, ScrollToPosition, Boolean)

    Scrolls the SfListView item into given data object.

    Declaration
    public void ScrollTo(object itemData, ScrollToPosition scrollToPosition, bool disableAnimation = false)
    Parameters
    Type Name Description
    System.Object itemData

    Represents the data object.

    Microsoft.Maui.Controls.ScrollToPosition scrollToPosition

    Defines position in the view to which object is scrolled.

    System.Boolean disableAnimation

    True to disable scroll animation while changing the view; otherwise, false. The default is false.

    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.ItemsSource = viewModel.ContactsInfo;
    listView.ScrollTo(ViewModel.ContactsInfo[30], ScrollToPosition.End, true);

    SelectAll()

    Select all the items in the SfListView.

    Declaration
    public void SelectAll()

    SwipeItem(Object, Double)

    Swipes an item to the specified offset value.

    Declaration
    public void SwipeItem(object itemData, double offset)
    Parameters
    Type Name Description
    System.Object itemData

    The item data of the list view item to be swiped.

    System.Double offset

    The value indicating how much the item should be swiped.

    Examples
    SfListView listView = new SfListView();
    ViewModel viewModel = new ViewModel();
    listView.ItemsSource = viewModel.BookInfo;
    // StartSwipe
    listView.SwipeItem(viewModel.BookInfo[3], 200);
    // EndSwipe
    listView.SwipeItem(viewModel.BookInfo[3], -200);

    Events

    GroupCollapsed

    Occurs when a group is collapsed.

    Declaration
    public event EventHandler<GroupExpandCollapseChangedEventArgs> GroupCollapsed
    Event Type
    Type Description
    System.EventHandler<GroupExpandCollapseChangedEventArgs>
    Remarks

    This event occurs after the GroupCollapsing event if that event is not canceled.

    Examples

    The following example demonstrates how to wire the group collapsed event in SfListView.

    listView.GroupCollapsed += ListView_GroupCollapsed;
    

    private void ListView_GroupCollapsed(object sender, GroupExpandCollapseChangingEventArgs e) { // Do required actions here. }

    See Also
    GroupCollapsing
    GroupExpanding
    GroupExpanded

    GroupCollapsing

    Occurs when a group is being collapsed.

    Declaration
    public event EventHandler<GroupExpandCollapseChangingEventArgs> GroupCollapsing
    Event Type
    Type Description
    System.EventHandler<GroupExpandCollapseChangingEventArgs>
    Remarks

    The GroupCollapsing event is a cancelable event and can be canceled by handling the event and setting the Cancel property to true. However, if the event is canceled, the group collapsing process for the tapped ListViewGroupHeaderItem gets cancelled. Also, we can customize the group being collapsed through GroupExpandCollapseChangingEventArgs event argument.

    Examples

    The following example demonstrates how to wire the group collapsing event in SfListView.

    listView.GroupCollapsing += ListView_GroupCollapsing;
    

    private void ListView_GroupCollapsing(object sender, GroupExpandCollapseChangingEventArgs e) { if (e.Groups[0] == listView.DataSource.Groups[0]) e.Cancel = true; }

    See Also
    GroupCollapsed
    GroupExpanding
    GroupExpanded

    GroupExpanded

    Occurs when a group is expanded.

    Declaration
    public event EventHandler<GroupExpandCollapseChangedEventArgs> GroupExpanded
    Event Type
    Type Description
    System.EventHandler<GroupExpandCollapseChangedEventArgs>
    Remarks

    This event occurs after the GroupExpanding event if that event is not canceled.

    Examples

    The following example demonstrates how to wire the group expanded event in SfListView.

    listView.GroupExpanded += ListView_GroupExpanded;
    

    private void ListView_GroupExpanded(object sender, GroupExpandCollapseChangingEventArgs e) { // Do required actions here. }

    See Also
    GroupExpanding
    GroupCollapsing
    GroupCollapsed

    GroupExpanding

    Occurs when a group is being expanded.

    Declaration
    public event EventHandler<GroupExpandCollapseChangingEventArgs> GroupExpanding
    Event Type
    Type Description
    System.EventHandler<GroupExpandCollapseChangingEventArgs>
    Remarks

    The GroupExpanding event is a cancelable event and can be canceled by handling the event and setting the Cancel property to true. However, if the event is canceled, the group expanding process for the tapped ListViewGroupHeaderItem gets cancelled. Also, we can customize the group being expanded through GroupExpandCollapseChangingEventArgs event argument.

    Examples

    The following example demonstrates how to wire the group expanding event in SfListView.

    listView.GroupExpanding += ListView_GroupExpanding;
    

    private void ListView_GroupExpanding(object sender, GroupExpandCollapseChangingEventArgs e) { if (e.Groups[0] == listView.DataSource.Groups[0]) e.Cancel = true; }

    See Also
    GroupExpanded
    GroupCollapsing
    GroupCollapsed

    ItemAppearing

    Occurs when the visual representation of a ListViewItem is being added to the Syncfusion.Maui.ListView.SfListView.VisualContainer.

    Declaration
    public event EventHandler<ItemAppearingEventArgs> ItemAppearing
    Event Type
    Type Description
    System.EventHandler<ItemAppearingEventArgs>
    Remarks

    The ItemAppearing event is raised when the items are appearing in the view on scrolling, loading, and navigating from one page to another page.

    Examples

    The following example demonstrates how to wire an item appearing event in SfListView.

    listView.ItemsSource = viewModel.BookInfo;
    listView.ItemAppearing += listView_ItemAppearing;
    

    private void listView_ItemAppearing(object sender, ItemAppearingEventArgs e) { if (e.DataItem == viewModel.BookInfo[0]) Debug.WriteLine((e.DataItem as BookInfo).BookName); // If the DataItem value is "Header", then it's a header item. if (e.DataItem == "Header") Debug.WriteLine("Header is Appeared"); }

    ItemDisappearing

    Occurs when the visual representation of a ListViewItem is being removed from the Syncfusion.Maui.ListView.SfListView.VisualContainer.

    Declaration
    public event EventHandler<ItemDisappearingEventArgs> ItemDisappearing
    Event Type
    Type Description
    System.EventHandler<ItemDisappearingEventArgs>
    Remarks

    The ItemDisappearing event is raised when the items disappearing in the view on scrolling, disposing, and navigating from one page to another page.

    Examples

    The following example demonstrates how to wire an item disappearing event in SfListView.

    listView.ItemsSource = viewModel.BookInfo;
    listView.ItemDisappearing += listView_ItemDisappearing;
    

    private void listView_ItemDisappearing(object sender, ItemDisappearingEventArgs e) { if (e.DataItem == viewModel.BookInfo[0]) Debug.WriteLine((e.DataItem as BookInfo).BookName); // If the DataItem value is "Footer" then it's a Footer item. if (e.DataItem == "Footer") Debug.WriteLine("Footer is Disappeared"); }

    ItemDoubleTapped

    Occurs when an item is double tapped.

    Declaration
    public event EventHandler<ItemDoubleTappedEventArgs> ItemDoubleTapped
    Event Type
    Type Description
    System.EventHandler<ItemDoubleTappedEventArgs>
    Examples

    The following example demonstrates how to wire a double tapped event in SfListView.

    listView.ItemsSource = viewModel.InboxInfo;
    listView.ItemDoubleTapped += ListView_ItemDoubleTapped;
    

    private void ListView_ItemDoubleTapped(object sender, ItemDoubleTappedEventArgs e) { var listViewInboxInfo = new ListViewInboxInfo(); listViewInboxInfo.Title = "Bryce Thomas"; listViewInboxInfo.Subject = "Congratulations on the move!"; viewModel.InboxInfo.Add(listViewInboxInfo); }

    See Also
    ItemTapped
    ItemLongPress

    ItemLongPress

    Occurs when an item is long pressed.

    Declaration
    public event EventHandler<ItemLongPressEventArgs> ItemLongPress
    Event Type
    Type Description
    System.EventHandler<ItemLongPressEventArgs>
    Examples

    The following example demonstrates how to wire a holding event in SfListView.

    listView.ItemsSource = viewModel.InboxInfo;
    listView.ItemLongPress += ListView_ItemLongPress;
    

    private void ListView_ItemLongPress(object sender, ItemLongPressEventArgs e) { if (e.DataItem == viewModel.InboxInfo[0]) viewModel.InboxInfo.Remove(e.DataItem as ListViewInboxInfo); }

    See Also
    ItemTapped
    ItemDoubleTapped

    ItemTapped

    Occurs when an item is tapped.

    Declaration
    public event EventHandler<ItemTappedEventArgs> ItemTapped
    Event Type
    Type Description
    System.EventHandler<ItemTappedEventArgs>
    Examples

    The following example demonstrates how to wire a tapped event in SfListView.

    listView.ItemsSource = viewModel.InboxInfo;
    listView.ItemTapped += ListView_ItemTapped;
    

    private void ListView_ItemTapped(object sender, ItemTappedEventArgs e) { viewModel.InboxInfo.Remove(e.DataItem as ListViewInboxInfo); }

    See Also
    ItemDoubleTapped
    ItemLongPress

    Loaded

    Occurs when a SfListView is loaded for the first time.

    Declaration
    public event EventHandler<ListViewLoadedEventArgs> Loaded
    Event Type
    Type Description
    System.EventHandler<ListViewLoadedEventArgs>
    Remarks

    This event occurs only once when a SfListView is loaded in view for the first time. Any properties set in this event call back will lead to an additional refresh call when the SfListView is loaded.

    Examples

    The following example demonstrates how to wire the Loaded event in SfListView.

    listView.Loaded += ListView_Loaded;
    

    private void ListView_Loaded(object sender, ListViewLoadedEventArgs e) { listView.SelectedItems.Add(viewModel.Customers[2]); }

    QueryItemSize

    Occurs whenever an item comes into view and query the item size.

    Declaration
    public event EventHandler<QueryItemSizeEventArgs> QueryItemSize
    Event Type
    Type Description
    System.EventHandler<QueryItemSizeEventArgs>
    Remarks

    We can define whether the specified size can be set to the item or not by handling the QueryItemSize event. When the Handled property in the QueryItemSizeEventArgs argument is false, the decided size will not be set to the item.

    Examples

    The following example demonstrates how to wire the QueryItemSize event in SfListView.

    listView.QueryItemSize += ListView_QueryItemSize;
    

    private void ListView_QueryItemSize(object sender, QueryItemSizeEventArgs e) { if (e.ItemIndex == 1) { e.ItemSize = 300; e.Handled = true; } }

    See Also
    ItemSize
    AutoFitMode
    GroupHeaderSize
    HeaderSize
    FooterSize

    ScrollStateChanged

    Occurs when the SfListView's scrolling state changed.

    Declaration
    public event EventHandler<ScrollStateChangedEventArgs> ScrollStateChanged
    Event Type
    Type Description
    System.EventHandler<ScrollStateChangedEventArgs>
    Remarks

    This event only works with Android API level 23 and above.

    Examples

    The following example demonstrates how to wire the ScrollStateChanged event in SfListView.

    listView.ScrollStateChanged += ListView_ScrollStateChanged;
    

    private void ListView_ScrollStateChanged(object sender, ScrollStateChangedEventArgs e) { if (e.ScrollState == ScrollState.Idle) DisplayAlert("ScrollState", "Scrolling has stopped", "OK"); }

    SelectionChanged

    Occurs once the selection process has been completed for selected item in SfListView.

    Declaration
    public event EventHandler<ItemSelectionChangedEventArgs> SelectionChanged
    Event Type
    Type Description
    System.EventHandler<ItemSelectionChangedEventArgs>
    Examples

    The following example demonstrates how to wire the selection changed event in SfListView.

    listView.SelectionChanged += ListView_OnSelectionChanged;
    

    private void ListView_OnSelectionChanged(object sender, ItemSelectionChangedEventArgs e) { //To do }

    See Also
    SelectionChanging

    SelectionChanging

    Occurs when selecting an item at the execution time.

    Declaration
    public event EventHandler<ItemSelectionChangingEventArgs> SelectionChanging
    Event Type
    Type Description
    System.EventHandler<ItemSelectionChangingEventArgs>
    Remarks

    The SelectionChanging event is a cancelable event and can be canceled by handling the event and setting the Cancel property to true. However, if the event is canceled, the selection process for the selected ListViewItem gets cancelled.

    Examples

    The following example demonstrates how to wire the selection changing event in SfListView.

    listView.ItemsSource = viewModel.Items;
    listView.SelectionChanging += ListView_SelectionChanging;
    

    private void ListView_SelectionChanging(object sender, ItemSelectionChangingEventArgs e) { if (e.AddedItems[0] == ViewModel.Items[0]) e.Cancel = true; }

    See Also
    SelectionChanged

    SwipeEnded

    Occurs when a swipe action is completed for an item in the SfListView.

    Declaration
    public event EventHandler<SwipeEndedEventArgs> SwipeEnded
    Event Type
    Type Description
    System.EventHandler<SwipeEndedEventArgs>
    Examples

    The following example demonstrates how to handle the SwipeEnded event in the SfListView.

     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True"
                            SwipeEnded="listView_SwipeEnded">
     </syncfusion:SfListView>
    
    

    private void listView_SwipeEnded(object sender, SwipeEndedEventArgs e) { if (e.SwipeOffset > 70) listView.ResetSwipe(); }

    SwipeReset

    Occurs when the swiped item in the SfListView gets reset to its original position.

    Declaration
    public event EventHandler<ResetSwipeEventArgs> SwipeReset
    Event Type
    Type Description
    System.EventHandler<ResetSwipeEventArgs>
    Remarks

    The swipe reset action can be canceled by setting the to true.

    SwipeStarting

    Occurs when the user starts to swipe an item in SfListView control.

    Declaration
    public event EventHandler<SwipeStartingEventArgs> SwipeStarting
    Event Type
    Type Description
    System.EventHandler<SwipeStartingEventArgs>
    Remarks

    The SwipeStarting event can be canceled by handling the event and setting the <SwipeStartingEventArgs.Cancel></SwipeStartingEventArgs.Cancel> property to true. If the event is canceled, the swiping action will not be triggered.

    Examples

    The following example demonstrates how to wire the SwipeStarting event in SfListView and cancel the swiping action on specific item in the list.

     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True"
                            SwipeStarting="listView_SwipeStarting">
     </syncfusion:SfListView>
    
    

    private void listView_SwipeStarting(object sender, SwipeStartingEventArgs e) { if (e.ItemIndex == 1) e.Cancel = true; }

    Swiping

    Occurs when an item in the SfListView is being swiped.

    Declaration
    public event EventHandler<SwipingEventArgs> Swiping
    Event Type
    Type Description
    System.EventHandler<SwipingEventArgs>
    Remarks

    The Swiping event can be handled by setting the <SwipingEventArgs.Handled></SwipingEventArgs.Handled> property to true which holds the current swipe offset value for the swiped item until the SwipeEnded event is raised.

    Examples

    The following example demonstrates how to wire the swiping event in SfListView.

     <syncfusion:SfListView x:Name="listView"
                            ItemsSource="{Binding contactsinfo}"
                            AllowSwiping="True"
                            Swiping="listView_Swiping">
     </syncfusion:SfListView>
    
    

    private void listView_Swiping(object sender, SwipingEventArgs e) { if (e.OffSet > 70) e.Handled = true; }

    Implements

    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<>
    System.Collections.Generic.ICollection<>
    System.Collections.Generic.IEnumerable<>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.IVisualTreeElement

    Extension Methods

    SfListViewHelper.GetVisualContainer(SfListView)
    SfListViewHelper.GetScrollView(SfListView)
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved