jamesmontemagno / Xamarin.Forms-PullToRefreshLayout

Pull To Refresh a ScrollView or ListView in Xamarin.Forms
218 stars 49 forks source link

Fix Issue #42 #59

Closed Miiite closed 5 years ago

Miiite commented 5 years ago

This PR has for goal to fix the issue https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout/issues/42

Having looked at this stackoverflow post it seems that setting .Enabled = false on a UIRefreshControl does not do anything, because it's actually the UIScrollView wrapping the UIRefreshControl that decides whether or not the control should be displayed.

Following that logic the solution seems to simply remove the UIRefreshControl from its Superview when the property IsPullToRefreshEnabled is set to false, and to try to insert it again when IsPullToRefreshEnabled is set to true.

Also updated the ListViewPage sample, to demonstrate the working databinding on the IsPullToRefreshEnabled property.

Also fixed a typo in ListViewPage.cs refreshView.SetBinding(PullToRefreshLayout.IsRefreshingProperty, , new Binding("IsBusy", BindingMode.OneWay)); that was preventing the sample project from building.

Note: Changes to the .csproj file are automatically applied by Visual Studio for mac