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

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

I have the following ListView:


    
        
            

        
7条回答
  •  Happy的楠姐
    2020-11-29 19:54

    Found the solution from here: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/3d0eaa54-09a9-4c51-8677-8e90577e7bac/


    XAML:

    
        
    
    
    
        
            
                
                
            
        
    
    

    C#:

    protected void HandleDoubleClick(object sender, MouseButtonEventArgs e)
    {
        var track = ((ListViewItem) sender).Content as Track; //Casting back to the binded Track
    }
    

提交回复
热议问题