diff options
3 files changed, 54 insertions, 7 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43214.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43214.cs new file mode 100644 index 00000000..0480bf54 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43214.cs @@ -0,0 +1,52 @@ +using System.Linq; +using System.Threading.Tasks; +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + + +namespace Xamarin.Forms.Controls +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 43214, "Setting Listview.IsRefreshing to false does not work on second \"pull\"")] + public class Bugzilla43214 : TestContentPage + { + public class MyViewModel : ViewModel + { + bool _isBusy; + + public bool IsBusy + { + get { return _isBusy; } + set + { + _isBusy = value; + OnPropertyChanged(); + } + } + } + + protected override void Init() + { + var vm = new MyViewModel(); + + var label = new Label { Text = "Pull list to refresh once, then pull to refresh again. If the indicator does not disappear, this test has failed." }; + var listview = new ListView + { + ItemsSource = Enumerable.Range(0, 20), + IsPullToRefreshEnabled = true, + RefreshCommand = new Command(async () => + { + vm.IsBusy = true; + await Task.Delay(1000); + vm.IsBusy = false; + }) + }; + + listview.SetBinding(ListView.IsRefreshingProperty, nameof(MyViewModel.IsBusy)); + + var stacklayout = new StackLayout { Children = { label, listview }, BindingContext = vm }; + + Content = stacklayout; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 8d1e0b40..6d35da9f 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -173,6 +173,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla42277.cs" /> <Compile Include="$(MSBuildThisFileDirectory)ImageLoadingErrorHandling.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla33561.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43214.cs" /> <Compile Include="$(MSBuildThisFileDirectory)_Template.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" /> diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs index 7cd691f9..d0dacbd4 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs @@ -1016,7 +1016,6 @@ namespace Xamarin.Forms.Platform.iOS readonly ListView _list; IListViewController Controller => _list; UIRefreshControl _refresh; - bool _refreshingEventSent; bool _refreshAdded; @@ -1124,13 +1123,8 @@ namespace Xamarin.Forms.Platform.iOS void OnRefreshingChanged(object sender, EventArgs eventArgs) { - if (_refresh.Refreshing && !_refreshingEventSent) - { + if (_refresh.Refreshing) Controller.SendRefreshing(); - _refreshingEventSent = true; - } - else if (!_refresh.Refreshing) - _refreshingEventSent = false; } void RemoveRefresh() |