As I'm not processing the items in a ListView based on what a user may select (the processing always uses everything in the list), I want to disallow the selecting of an item which may make the user think he is limiting the processing to that one item (I've already got multiselect = false, so that's not an issue).
There is not any property to disable item selection in the ListView
.
What you can do is to handle the event that notifies that an item has been selected by attaching an event handler to ItemSelectionChanged
and then deselect the item:
yourListView.ItemSelectionChanged += yourListView_ItemSelectionChanged;
private void yourListView_ItemSelectionChanged(
object sender,
ListViewItemSelectionChangedEventArgs e)
{
if (e.IsSelected)
e.Item.Selected = false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With