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
How about
DataSource = null;
DataBind();
This is bit late, but this works for me at least using UWP
myListView.ItemsSource = null;
The Problem is arising because you are trying to clear the entire list box. Just use listView1.Items.Clear();
listView.Items.Clear()
listView.Refresh()
/e Updating due to lack of explanation. Often times, Clear() isn't suffice in the event of immediate events / methods following. It's best to update the view with Refresh() following a Clear() for an instant reflection of the listView clearing. This, anyhow had solved my related issues.
Try with this:
myListView.ItemsSource = new List< DictionaryEntry >();
I did a search on this and I am using WPF c#. Just in case you got here too looking for a WPF solution use the following:
yourlistview.ItemsSource = null;