How to update ListView WinForms when using VirtualMode = True?

I have an application with a large ListView that is terribly slow, so I am implementing VirtualMode. MSDN does not seem to describe how I will add or remove new items in the middle of the list.

For example, a ListView has 1000 elements (representing files on disk) and after the initial ListView collection (by the RetrieveVirtualItem event), some files will be deleted and some added so that VirtualListSize can even be the same after the update.

Question 1) How can I say that the ListView "these items have been modified / deleted" so that it asks?

In addition, some files just change, and I would like to reflect their changed status in the list.

Question 2) How to find an item in the list, given that VirtualMode does not allow me to access the Items collection that I used before (I used the ContainsKey method in this collection).

It sounds simple, but I do not see it myself. Help with thanks.

Ryan

+3
source share
1 answer

To add or remove items, set SimList VirtualListSize to the total number of items. Use individual RedrawItems to update individual items.

To find a specific item, you are using a container that you already have, do not return to the ListView. The characters in your list must match the items in the list.

+3
source

Source: https://habr.com/ru/post/1698542/


All Articles