roubachof / Xamarin-Forms-Practices

Collection of good practices for Xamarin forms developement
291 stars 57 forks source link

How to use Pull-to-Refresh like as ListView? #2

Closed phamthanhtong closed 4 years ago

phamthanhtong commented 5 years ago

HorizontalListView control did not have IsPullToRefreshEnabled property. Could you share how to use Pull-to-Refresh like as ListView?

Thanks.

roubachof commented 5 years ago

Good question!

You can use the following layout:

<TaskLoaderView>
    <PullToRefreshLayout>
        <HorizontalListView>

It's the same here:

https://github.com/roubachof/Xamarin-Forms-Practices/blob/master/SillyCompany.Mobile.Practices/Presentation/Views/SillyDudePage.xaml

which is bound to:

https://github.com/roubachof/Xamarin-Forms-Practices/blob/master/SillyCompany.Mobile.Practices/Presentation/ViewModels/SillyDudeVm.cs

The view model is very simple: all the hard work is done by the ViewModelLoader and the TaskLoaderView.

If you didn't know what is the TaskLoaderView, have a look here:

https://github.com/roubachof/Sharpnado.Presentation.Forms#taskloaderview

phamthanhtong commented 5 years ago

Thanks. I used your solution. Android is OK. But iOS cannot pull to refresh.

<PullToRefreshLayout>
      <HorizontalListView>

After that, I tried to change to:

<PullToRefreshLayout>
     <ScrollView>
         <HorizontalListView>

iOS is OK. But Android cannot scroll up.

Could you give me a review?

phamthanhtong commented 5 years ago

@roubachof Could you share me a solution?

roubachof commented 5 years ago

@phamthanhtong if you send me a repo with a repro sample before thursday I will be able to have a look by the end of the week ;)

roubachof commented 4 years ago

Ok the issue with the RefreshView and the iOS version of the HorizontalListView will be fixed in v1.4.0