Hi, i have currently a performance problems with UltraListView which should show a folder content with big number of files.
My idea was to create items first with name and default icon only. Then get the subitem values and right thumbnail later if the item gets visible.
I haven't found an event like "ItemVisibleChanged" or alike. Is it possible somehow else, may be with creation filter?
Thank you
Hello,
I am just checking about the progress of this issue. Let me know if you need my further assistance on this issue.
Thank you for using Infragistics Components.
Hi,
Thank you for the reply.
You can use another thread for background operations and that would probably speed up the scrolling depending on how much time these operations take. In that case you will have to be really careful to update the ListView only from the UI thread as otherwise different crashes and unexpected behaviors are possible. Also the items will probably be displayed uninitialized at first when they are first displayed until the background operation completes.
For disposing of resources for items which are out of view you can try checking if the parent is UltraListViewItemContainerUIElement and if it is to check if any resource needs to be disposed, but that would definitely slow the scrolling even further. An alternative approach would be to use a timer and dispose the unnecessary resource in it.
Please let me know if you have any additional questions.
Thank you for the fast answer.
No, I don't think there is a bug in UltraListView control. Seems one of my collegues has adopted your File Explorer sample in some weird manner. The items are already initialized as an array and added with AddRange. But the most time was wasted for getting file icons and SHGetFileInfo calls. We also getting some additional infos from DB for the file items. And that all was for all items once in UI thread, which blocks the application for about 30 seconds if the folder contains some thousands files. (tried with e.g. user temp folder)
I have already tried the custom creation filter solution from Dimitar. It works already much faster. Blocking time is about 2 seconds, which is comparable with windows explorer, perhaps just for getting the files list.
I have still some questions:
- The scrolling is now somehow stuttering. Is there further optimization possibilities here? Would it bring something if I use other thread or async/await within creation filter?
- Still some problems with out of memory now. I would try to dispose the item icons if out of visibility. Is it possible?
It would probably be better if you could provide more details on the performance problem; if there's a bug causing it, we would probably want to fix that.
Note that when dealing with large numbers of items, the best way to populate the control's Items collection is to first populate an array, and then use the UltraListView.Items.AddRange method. Because the control has a lot of housekeeping to do when you use the Add method, performance can be orders of magnitude better in some cases when you use AddRange instead.
Also note that there is a sample (might be in the legacy samples now) called Infragistics File Explorer, which features this control, and demonstrates how to emulate the Windows File Explorer using the UltraListView control.
Thank you for posting in our forums.
Using the Creation Filter interface will be a good way to implement this, as the methods of the interface will be called only if the list view item is drawn on the screen. So you can save the information about the item, for example in the item’s tag, and then initialize it in the AfterCreateChildElements method.
I have attached a sample which demonstrates this suggestion. In the sample, use the “Chose Folder…” button in order to choose the folder, from which to load the files.