Hey,
when I try to create a ListView with around 200 items, the ListViewer is stucking for a few seconds, each time I’m scrolling, due to the amount of items.
I already tried to create a VerticalScrollArrangement and put the ListView into it. Then I set the height of the ListView to the actual height of each item combined, using these blocks:
The listview is already scrollable. So, I think you don’t need the Vertical Scroll Arrangement. (And that may be reason , why it gets stuck during scrolling)
Try to put the Listview in simple Vertical arrangement instead.
@Mika
I don’t want to change the item height. I just want a smooth ListView with around ~200 items.
@Vaibhav
The ListView is in a scroll arrangement cause there are other components above it. I want to hide these, once the user started scrolling in the List View. It is also lagging, when it is in scrollable. In VerticalScrollArrangement it has smooth scroll Animation, but it takes time to load once I set the arrangement visible.
What I’m looking for is a way to async load the items. Maybe a extension or a alternative to listView could help me?
I did never have a list view with more than 20 options, now I am gonna have one that may have hundreds and I am worried that it may have performance issues. Searching for this I found your topic. I guess your solution may be useful if I (and others) have the same problem.
First of all, I should mention, that I used ColinTree’s free custom ListView Extension. But you only need this if you are using ListView without images. Otherwise you can use the given ListView with pictures.
So here is my solution:
1st: Set the ListView height to ItemHeight×LengthOfList
(Height in % is: Screen1.heightx0.04 <- This would be 4%)
2nd: Make a clock which adds all items 1 by 1.
This is why you need the extension. The normal ListView doesn’t have a feature to add items (only to overwrite the whole list with a new item).
This solution may take a while (few seconds with ~200 items), but the app doesn’t freeze and the List is loading while you can watch/use it.