Skip to content

This example demonstrates about how to load the SfListView control as PullableContent of .NET MAUI PullToRefresh (SfPullToRefresh).

Notifications You must be signed in to change notification settings

SyncfusionExamples/load-listview-as-pullable-content-of-.net-maui-pull-to-refresh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Host .NET MAUI ListView as pullable content

To host the .NET MAUI ListView inside the PullToRefresh, which is used to update items in the list while performing the pull to refresh action.

  1. Add the required assembly references as discussed in the ListView and PullToRefresh
  2. Import the SfPullToRefresh control and SfListView control namespace as follows.

  3. xmlns:ListView="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView"
    xmlns:pulltoRefresh="clr-namespace:Syncfusion.Maui.PullToRefresh;assembly=Syncfusion.Maui.PullToRefresh"
    
    using Syncfusion.Maui.ListView;
    using Syncfusion.Maui.PullToRefresh;
    

  4. Define the ListView as PullableContent of the SfPullToRefresh.
  5. Handle the pull to refresh events for refreshing the data.
  6. Customize the required properties of ListView and PullToRefresh based on your requirement.
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            x:Class="RefreshableListView.MainPage"
            xmlns:ListView="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView"
            xmlns:pulltoRefresh="clr-namespace:Syncfusion.Maui.PullToRefresh;assembly=Syncfusion.Maui.PullToRefresh"
            xmlns:local="clr-namespace:RefreshableListView">

    <ContentPage.Behaviors>
        <local:ListViewPullToRefreshBehavior />
    </ContentPage.Behaviors>

    <ContentPage.Content>
        <Grid>
            <pulltoRefresh:SfPullToRefresh x:Name="pullToRefresh"
                                        RefreshViewHeight="50"
                                        RefreshViewThreshold="30"
                                        PullingThreshold="150"
                                        RefreshViewWidth="50"
                                        TransitionMode="SlideOnTop"
                                        IsRefreshing="False">
                <pulltoRefresh:SfPullToRefresh.PullableContent>
                    <Grid x:Name="mainGrid">
                        <ListView:SfListView Grid.Row="1"
                                            x:Name="listView"
                                            ItemsSource="{Binding InboxInfos}"
                                            ItemSize="102"
                                            SelectionMode="Single"
                                            ScrollBarVisibility="Always"
                                            AutoFitMode="Height">
                            . . . 
                            . . . .

                        </ListView:SfListView>
                    </Grid>
                </pulltoRefresh:SfPullToRefresh.PullableContent>
            </pulltoRefresh:SfPullToRefresh>
        </Grid>
    </ContentPage.Content>
</ContentPage>

How to run the sample

  1. Clone the sample and open it in Visual Studio.

    N> If you download the sample using the "Download ZIP" option, right-click it, select Properties, and then select Unblock.

  2. Register your license key in the App.cs file as demonstrated in the following code.

     public App()
     {
         //Register Syncfusion license
         Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
         
         InitializeComponent();
         
         MainPage = new AppShell();
     }
    

    Refer to this link for more details.

  3. Clean and build the application.

  4. Run the application.

About

This example demonstrates about how to load the SfListView control as PullableContent of .NET MAUI PullToRefresh (SfPullToRefresh).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages