How to capture a mouse click on an Item in a ListBox in WPF?

前端 未结 6 1372
长情又很酷
长情又很酷 2020-12-02 11:30

I want to get notified when an item in a ListBox gets clicked by the mouse, whether it is already selected or not.

I searched and found this: (http://kevin-berridge.

6条回答
  •  孤城傲影
    2020-12-02 11:54

    You can use the SelectionChangedEventArgs argument of the SelectionChanged event to find what item is add or removed through AddedItems and RemovedItems, usually only have the latest clicked on, or if not, then look at the last item which is the count-1.

提交回复
热议问题