diff --git a/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs index 42d7dcd3df74..be0b996afff3 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/ListViewRenderer.cs @@ -298,6 +298,12 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE UpdateVerticalScrollBarVisibility(); else if (e.PropertyName == ScrollView.HorizontalScrollBarVisibilityProperty.PropertyName) UpdateHorizontalScrollBarVisibility(); + else if(e.PropertyName == Microsoft.Maui.Controls.ListView.IsEnabledProperty.PropertyName) + { + UpdatePullToRefreshEnabled(); + UpdateSelectionMode(); + UpdateIsRefreshing(); + } } public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection) @@ -522,7 +528,7 @@ void UpdateHeader() void UpdateIsRefreshing() { - var refreshing = Element.IsRefreshing; + var refreshing = Element.IsRefreshing && Element.IsEnabled; if (_tableViewController != null) _tableViewController.UpdateIsRefreshing(refreshing); } @@ -689,7 +695,7 @@ void UpdatePullToRefreshEnabled() { if (_tableViewController != null) { - var isPullToRequestEnabled = Element.IsPullToRefreshEnabled && ListView.RefreshAllowed; + var isPullToRequestEnabled = Element.IsPullToRefreshEnabled && ListView.RefreshAllowed && ListView.IsEnabled; _tableViewController.UpdatePullToRefreshEnabled(isPullToRequestEnabled); } } @@ -731,7 +737,7 @@ void UpdateSeparatorVisibility() void UpdateSelectionMode() { - if (Element.SelectionMode == ListViewSelectionMode.None) + if (Element.SelectionMode == ListViewSelectionMode.None || !Element.IsEnabled) { Element.SelectedItem = null; var selectedIndexPath = Control.IndexPathForSelectedRow; @@ -1164,7 +1170,7 @@ public void OnItemSelected(object sender, SelectedItemChangedEventArgs eventArg) return; } - if (List == null) + if (List == null || !List.IsEnabled) return; var location = TemplatedItemsView.TemplatedItems.GetGroupAndIndexOfItem(eventArg.SelectedItem); @@ -1215,7 +1221,7 @@ public override void RowSelected(UITableView tableView, NSIndexPath indexPath) SetCellBackgroundColor(cell, UIColor.Clear); - if (List.SelectionMode == ListViewSelectionMode.None) + if (List.SelectionMode == ListViewSelectionMode.None || !List.IsEnabled) tableView.DeselectRow(indexPath, false); _selectionFromNative = true; @@ -1599,6 +1605,8 @@ public void UpdatePullToRefreshEnabled(bool pullToRefreshEnabled) RefreshControl = _refresh; } } + else + RemoveRefresh(); // https://bugzilla.xamarin.com/show_bug.cgi?id=52962 // just because pullToRefresh is being disabled does not mean we should kill an in progress refresh. // Consider the case where: