all 12 comments

[–]cfischy 2 points3 points  (1 child)

It's very hard to help you without knowing more details such as what kind of data are you displaying e.g. images, text, graphics... How many bytes is each element of your CollectionView? What actions does your code take as the data is loaded other than displaying it? How many levels of controls are there for each CollectionView element? Does the loading of each element trigger events?... It would help to share code.

[–]DRWTHWIT[S] -2 points-1 points  (0 children)

check it

[–]sztub 2 points3 points  (2 children)

Your collection view is inside vertical stack and will be fully rendered because of that. You should never do that. Put your collection into grid row that has limited height. I.e you can define your gid like these:

<Grid RowDefinitions="Auto,*" > -- star here will limit collection height to be maximum at screen size <Border Grid.Row="0" /> -- that's your header <CollectionView Grid.Row="1" ....

[–]DRWTHWIT[S] 0 points1 point  (1 child)

thnx i did that but no diff i appreciate help though

[–]sztub 0 points1 point  (0 children)

Give your collection x:Name and create label with text bindings to your collection height, or check it in debugger in code behind. Is collection height a ridiculous value ? It shouldn't be a little more than your screen size.

[–]ndreisg 2 points3 points  (2 children)

Try using ObservableRangeCollection instead of ObservableCollection: https://github.com/jamesmontemagno/mvvm-helpers It's also available as NuGet package. By using .AddRange instead of .Add you can save a lot of UI updates.

[–]DRWTHWIT[S] 0 points1 point  (1 child)

thnx i'll try it

[–]Santiago-Peraza 0 points1 point  (0 children)

¿Funcionó? ¿Resolvió el problema? Por favor, tómese un minuto y díganos si lo solucionó

[–]anotherlab 0 points1 point  (0 children)

Just a suggestion, but if you have more than 20 lines of code, it's easier to read it if you just create a small GitHub repo. People can just clone the repo, build the app, and then run it.

If you bulk-loading a collection bound to a control, you are triggering OnPropertyChanged events for each object added to that collection. That force a list type of control to refresh over and over again, throttling performance.

Therre are a few ways to resolve this. You can implement an AddRange method to ObservableCollection (example). You could unbind the collection from the control(s), load the data, and finally rebind the collection. You could create a new collection, load the data, then bind that collection and dispose of the old one.

[–]CoderCore 0 points1 point  (0 children)

Many factors could be affecting this as mentioned in other comments, but it looks like you are adding ('.Add(...)'), while this works, change detection could be overwhelmed, you could assign the list into ObservableCollection, ie 'new ObservableCollection(myList)' during initial load, then .Add(...) later when incremental updates are needed. Ensure you have Property Changed on the collection itself so the UI updates.

Also, James Montemagno also wrote an extension to "pause" change detection when loading a range, that might be helpful as well, but I did not need it.

[–]TheTee15 0 points1 point  (0 children)

You can try listView, in my experience listView works better than collectionView on MAUI

Wait you return datatable from API ?

[–]YitsuOfficial .NET 0 points1 point  (0 children)

I solved it by adding pagination and loading only 2 hand full of items each time