Monday, 2 September 2013

Prevent freezing the UI when modify ListView?

Prevent freezing the UI when modify ListView?

I'm facing a problems when trying to modify the subitem's text of a
ListView (about 20k records, virtual mode enabled = false).
for(int i = 0; i < list.Items.Count; i++)
{
list.Items[i].SubItem[3].Text = "";
}
Inspite of using:
var worker = new BackgroundWorker();
worker.DoWork += (s, e) =>
{
for(int i = 0; i < list.Items.Count; i++)
{
list.Invoke((MethodInvoker)(() => { list.Items[i].SubItem[3].Text
= ""; }));
}
};
worker.RunWorkAsync();
Any helps are appreciated!

No comments:

Post a Comment