Hello,
I have a problem when I want to add a lot of item (with picture) has both in a listview.
In fact, I have a loop that adds about 400 items, but when I run this loop, the listview takes a long time to fill.
I tried my code with a winform listview and there is no problem, items are added instantly.
Here is my code :
Sorry for my english,I'm French
Thanx
I have a problem when I want to add a lot of item (with picture) has both in a listview.
In fact, I have a loop that adds about 400 items, but when I run this loop, the listview takes a long time to fill.
I tried my code with a winform listview and there is no problem, items are added instantly.
Here is my code :
List<ListViewDataItem> items = new List<ListViewDataItem>();
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { int nb = 0; foreach (ListViewDataItem item in items) { item.ImageIndex = nb; this.Invoke(new AddItem(AddItem2), item); nb += 1; } lblStatus.Text = "Chargement terminé"; } private delegate void AddItem(ListViewDataItem itm); private void AddItem2(ListViewDataItem itm) { radListView1.Items.Add(itm); radListView1.Refresh(); }Thanx