I want to catch the event when a listview is left-clicked on an empty space - i.e. clicking on no item within the listview control.
I've search in the Events list of the listview but found none. How can I do this? Please help!
[Edit] What I want to do if I could catch this event: Deselect all items in the listview.
If you attach a handler to the MouseLeftButtonDown event on the ListView it will only fire when areas outside of a ListViewItem are clicked. Any clicks inside the items will be handled by the items themselves to drive the ListView's selection behavior.
You can make changes to the clickable areas by adjusting the Background ({x:Null} is not clickable, anything else is) and Margin of the ListViewItems by setting an ItemContainerStyle on the ListView. Also make sure that you are not using a null Background on the ListView itself (White is the default, Transparent works too).
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