WPF ListView - detect when selected item is clicked

前端 未结 7 932
刺人心
刺人心 2020-11-29 02:10

I\'m using a WPF ListView control which displays a list of databound items.


    
                 


        
相关标签:
7条回答
  • 2020-11-29 02:37

    I would also suggest deselecting an item after it has been clicked and use the MouseDoubleClick event

    private void listBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        try {
            //Do your stuff here
            listBox.SelectedItem = null;
            listBox.SelectedIndex = -1;
        } catch (Exception ex) {
            System.Diagnostics.Debug.WriteLine(ex.Message);
        }
    }
    
    0 讨论(0)
提交回复
热议问题