Skip to content

Commit

Permalink
[iOS] PullToRefresh & item selection when listView is not Enabled fix (
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo committed Jan 31, 2024
1 parent 4f32463 commit 7bcdac9
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ 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();
UpdateViewCellsEnabled();
}
}

public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection)
Expand Down Expand Up @@ -527,6 +534,14 @@ void UpdateIsRefreshing()
_tableViewController.UpdateIsRefreshing(refreshing);
}

void UpdateViewCellsEnabled()
{
foreach (var cell in TemplatedItemsView.TemplatedItems)
{
cell.IsEnabled = ListView.IsEnabled;
}
}

void UpdateItems(NotifyCollectionChangedEventArgs e, int section, bool resetWhenGrouped)
{
var exArgs = e as NotifyCollectionChangedEventArgsEx;
Expand Down Expand Up @@ -689,7 +704,7 @@ void UpdatePullToRefreshEnabled()
{
if (_tableViewController != null)
{
var isPullToRequestEnabled = Element.IsPullToRefreshEnabled && ListView.RefreshAllowed;
var isPullToRequestEnabled = Element.IsPullToRefreshEnabled && ListView.RefreshAllowed && ListView.IsEnabled;
_tableViewController.UpdatePullToRefreshEnabled(isPullToRequestEnabled);
}
}
Expand Down

0 comments on commit 7bcdac9

Please sign in to comment.