Articles in this section
Category / Section

How to add pull-to-refresh support in Xamarin.Forms ListView?

1 min read

When SearchBar or any view placed above the SfPullToRefresh control, then pulling action doesn’t work on SfListView because touches directly passed to SfListView instead of SfPullToRefresh control.

Hence you can overcome this problem by placing the SfListView inside the Grid and place that Grid as PullableContent of SfPullToRefresh as like below code example.

XAML

<ContentPage>
  <ContentPage.Content>
        <Grid RowSpacing="0" ColumnSpacing="0" Padding="0" Margin="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="50" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.Behaviors>
                <local:SfListViewPullToRefreshBehavior />
            </Grid.Behaviors>
            <SearchBar x:Name="filterText" Placeholder="Search" FontSize="14" />
 
            <pulltoRefresh:SfPullToRefresh x:Name="pullToRefresh" Grid.Row="1"
                                           ProgressBackgroundColor="#428BCA" RefreshContentHeight="50" 
                                           RefreshContentWidth="50" TransitionMode="Push" IsRefreshing="False">
                <pulltoRefresh:SfPullToRefresh.PullableContent>
                    <Grid>
                        <syncfusion:SfListView x:Name="listView" AllowSwiping="True"
                                   AutoFitMode="Height">
                        </syncfusion:SfListView>
                    </Grid>
                </pulltoRefresh:SfPullToRefresh.PullableContent>
            </pulltoRefresh:SfPullToRefresh>
        </Grid>
    </ContentPage.Content>
</ContentPage>

 

Screenshot:

 Graphical user interface, text

Description automatically generated

 

Click here to download the sample.



Conclusion

I hope you enjoyed learning about how to add pull-to-refresh support in Xamarin.Forms ListView.

You can refer to our Xamarin.Forms Listview feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Xamarin.forms Listview example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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