Articles in this section
Category / Section

How to enable load more after loading in xamarin.forms listview?

1 min read

ListView allows you enable load more after loading by setting the LoadMoreOption to none initially and changing it at run time.

xaml

 
<ContentPage xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms">
 
    <ContentPage.Resources>
        <ResourceDictionary>
            <helper:InverseBoolConverter x:Key="inverseBoolConverter"/>
        </ResourceDictionary>
    </ContentPage.Resources>
 
    <ContentPage.Content>
        <Grid>
            <Button Text="Enable/Disable load more"
                    Command="{Binding BindingContext.LoadMoreEnableCommand,Source={x:Reference Name=listView}}" 
                    CommandParameter="{Binding .,Source={x:Reference Name=listView}}"/>
            <syncfusion:SfListView x:Name="listView" 
                                   ItemSize="120"
                                   LoadMoreOption="{Binding EnableLoadMore}"
                                   LoadMoreCommand="{Binding LoadMoreItemsCommand}"
                                   LoadMoreCommandParameter="{Binding Source={x:Reference Name=listView}}"
                                   IsBusy="{Binding IsBusy}"
                                   ItemsSource="{Binding Products}">
                <syncfusion:SfListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Label Text="{Binding ContactName}"/>
                        </Grid>
                    </DataTemplate>
                </syncfusion:SfListView.ItemTemplate>
            </syncfusion:SfListView>
        </Grid>
    </ContentPage.Content>
</ContentPage>

 

You can enable the load more option after loading listview in button click.

C#

LoadMoreEnableCommand = new Command<object>(OnEnableClicked);
private void OnEnableClicked(object obj)
{
    if (EnableLoadMore == LoadMoreOption.None)
        EnableLoadMore = LoadMoreOption.Auto;
    else
        EnableLoadMore = LoadMoreOption.None;
}

 

Sample: Enable load more at run time

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied