What is a good way to select all or select no items in a listview without using:
foreach (ListViewItem item in listView1.Items)
{
item.Selected = true;
}
or
foreach (ListViewItem item in listView1.Items)
{
item.Selected = false;
}
i know the underlying Win32 listview common control supports LVM_SETITEMSTATE message which you can use to set the selected state, and by passing -1 as the index it will apply to all items. i'd rather not be PInvoking messages to the control that happens to be behind the .NET Listview control (i don't want to be a bad developer and rely on undocumented behavior - for when they change it to a fully managed ListView class)
Bump
Pseudo Masochist has the SelectNone case:
ListView1.SelectedItems.Clear();
Now just need the SelectAll code