WPF ListView: Attaching a double-click (on an item) event

前端 未结 7 1358
陌清茗
陌清茗 2020-11-29 19:12

I have the following ListView:


    
        
            

        
相关标签:
7条回答
  • 2020-11-29 20:09

    In your example are you trying to catch when an item in your ListView is selected or when a column header is clicked on? If it's the former you would add a SelectionChanged handler.

    <ListView Name="TrackListView" SelectionChanged="MySelectionChanged">
    

    If it's the latter you would have to use some combination of MouseLeftButtonUp or MouseLeftButtonDown events on the GridViewColumn items to detect a double click and take appropriate action. Alternatively you could handle the events on the GridView and work out from there which column header was under the mouse.

    0 讨论(0)
提交回复
热议问题