c# - How to populate listview with a lot of information without blocking? -
I am creating an array of ListViewItems on a background thread and then I populate my list view with it on the UI thread. The problem is that if the array is too large ui block, the list viewer is updated.
Is there any way to populate the list visibility with a small effect on ui?
After
What you can use in virtual mode is enough data to log in, so to do To set up ListView control property by true
. This means that the ListView will not be populated in the traditional sense, but you will hook up the item handlers where the item is displayed on the list view in small pieces as the item is being displayed.
Very Simple Example:
Private List & lt; String & gt; _listViewData = New list & lt; String & gt; (); Private Zero ToolStrip Button 1_Click (Object Sender, EventEurge E) {_listViewData = GetData (); // Find the list that will show in the list view list View1.VirtualListSize = _listViewData.Count; // list size set} // RetrieveVirtualItem event private zero listView_RetrieveVirtualItem (Object Sender, RetrieveVirtualItemEventArgs E) {event handler for e.I.EtemIndex & gt; = 0 & amp; e.ItemIndex & lt; _listViewData.Count ) {Eim = new list view item (_listViewData [eitm index]); }}
You should also use the event.
Comments
Post a Comment