获取列表视图的项目双击事件 [英] Get the item doubleclick event of listview
本文介绍了获取列表视图的项目双击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取列表视图的项目双击事件?
How to get the item double click event of listview?
推荐答案
我使用的是像这样的东西在ListViewItem的唯一触发双击而不是例如,当您在ListView控件的标题双击。
I'm using something like this to only trigger on ListViewItem double-click and not for example when you double-click on the header of the ListView.
private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
DependencyObject obj = (DependencyObject)e.OriginalSource;
while (obj != null && obj != myListView)
{
if (obj.GetType() == typeof(ListViewItem))
{
// Do something here
MessageBox.Show("A ListViewItem was double clicked!");
break;
}
obj = VisualTreeHelper.GetParent(obj);
}
}
这篇关于获取列表视图的项目双击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文