Forum Discussion
Is it normal for CollectionView to lag on larger lists, or am I missing an optimizaiton ?
I've been working with .NET MAUI recently and have run into some performance concerns when using CollectionView. Specifically, when binding a large dataset ( let's say 500+ items), the scrolling becomes noticeably sluggish, especially on Android
I've tried a few basic optimizations, like setting CachingStrategy = "RecycleElement" and minimizing the complexity of the DataTemplate, but the lag persists . I'm not using images or heavy UI elements either, it's just a simple text-based item template.
is this kind of lag expected with MAUI's CollectionView or is there a known workaround ? Are there additional performance tuning steps I should try ( virtualization tricks, async loading, grouping) ?
Yes, some lag in .NET MAUI's CollectionView with large datasets ( 500+ items) is a known issue, particularly on Android, but it can often be mitigated with additional optimizations beyond just setting CachingStrategy="RecycleElement".
Enable UI virtualization ( Default on Android) : MAUI's CollectionView on Android uses virtualization by default. Ensure you don't override it by using layout settings or customer renderers that disable virtualization.
Use CollectionView.ItemsSource as a List<T>
Use List<T> or other non-observable types if the list doesn't need to reflect real-time updates, this reduces unnecessary UI refresh triggers.
2 Replies
- BonillaIron Contributor
Thanks for pointing that out!
It turns out that using a
List <T>
instead of a
ObservableCollection
was the exactly the root cause of the lag I was seeing. I hadn't realized how much those unnecessary UI refreshes could slow things down.
- MarkowskiIron Contributor
Yes, some lag in .NET MAUI's CollectionView with large datasets ( 500+ items) is a known issue, particularly on Android, but it can often be mitigated with additional optimizations beyond just setting CachingStrategy="RecycleElement".
Enable UI virtualization ( Default on Android) : MAUI's CollectionView on Android uses virtualization by default. Ensure you don't override it by using layout settings or customer renderers that disable virtualization.
Use CollectionView.ItemsSource as a List<T>
Use List<T> or other non-observable types if the list doesn't need to reflect real-time updates, this reduces unnecessary UI refresh triggers.