C# Clear all items in ListView

前端 未结 12 1918
我在风中等你
我在风中等你 2020-12-03 13:39

I try to clear my listview but the clear method doesn\'t work:

myListView.Items.Clear();

This doen\'t work. When i put a breakpoint at this

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 13:47

    My guess is that Clear() causes a Changed event to be sent, which in turn triggers an automatic update of your listview from the data source. So this is a feature, not a bug ;-)

    Have you tried myListView.Clear() instead of myListView.Items.Clear()? Maybe that works better.

提交回复
热议问题