How to detect double click on list view scroll bar?

后端 未结 4 1689
长情又很酷
长情又很酷 2021-02-20 00:40

I have two list view on WPF. The first listview is loaded with a Datatable. When double clicking on one item from the first listview, the selectedItem is moved to the second lis

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-20 01:16

    I tested the above code which was very helpful, but found the following to be more stable, as sometimes the source gets reported as GridViewRowPresenter when in fact you are double clicking an item.

    var src = VisualTreeHelper.GetParent((DependencyObject)e.OriginalSource);
    var srcType = src.GetType();
    if (srcType == typeof(ListViewItem) || srcType == typeof(GridViewRowPresenter))
    {
        // Your logic here
    }
    

提交回复
热议问题