diff --git a/Maui.DataGrid/DataGrid.xaml.cs b/Maui.DataGrid/DataGrid.xaml.cs index bd1e406..ef4e049 100644 --- a/Maui.DataGrid/DataGrid.xaml.cs +++ b/Maui.DataGrid/DataGrid.xaml.cs @@ -212,7 +212,7 @@ private void SortAndPaginate(SortData? sortData = null) sortData ??= SortedColumnIndex; - var originalItems = ItemsSource.Cast().ToList(); + var originalItems = ItemsSource as IList ?? ItemsSource.Cast().ToList(); PageCount = (int)Math.Ceiling(originalItems.Count / (double)PageSize);