Get the item doubleclick event of listview

后端 未结 16 1474
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 02:17

What do I need to do in order to reference the double click event for a listview control?

16条回答
  •  时光说笑
    2020-12-01 02:29

    You can get the ListView first, and then get the Selected ListViewItem. I have an example for ListBox, but ListView should be similar.

    private void listBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListBox box = sender as ListBox;
            if (box == null) {
                return;
            }
            MyInfo info = box.SelectedItem as MyInfo;
            if (info == null)
                return;
            /* your code here */
            }
            e.Handled = true;
        }
    

提交回复
热议问题