How to handle an event when clicking on an empty space?

I want to catch an event when the list is scanned into empty space, i.e. Does not click an item in a listview control.

I have a search in the list of events list, but not found. How can i do this? Please, help!

[Change] What I want to do if I catch this event: Deselect all the items in the list.

+5
source share
3 answers

If you attach a handler to the MouseLeftButtonDown event in the ListView, it will work only when you click on areas outside the ListViewItem element. Any clicks within the elements will be handled by the elements themselves to control the behavior of the ListView selection.

, , ({x: Null} , - ) Margin of ListViewItems, ItemContainerStyle ListView. , ListView ( - , Transparent ).

+5

ListBoxItem ListBox. :

  • PreviewMouseDown ListBox
  • myListBox.AddHandler

. MouseDown ListBox .

0

, ( ), , , , ( ). , (vb.net):

Private Sub ListView1_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs) Handles ListView1.MouseLeftButtonDown

    ListView1.SelectedIndex = -1

End Sub

, , , .

0

All Articles