How to detect double click on list view scroll bar?

后端 未结 4 1690
长情又很酷
长情又很酷 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:21

    private void ListBox_OnMouseDoubleClick(object pSender, MouseButtonEventArgs pE)
    {
      FrameworkElement originalSource = pE.OriginalSource as FrameworkElement;
      FrameworkElement source = pE.Source as FrameworkElement;
    
      if (originalSource.DataContext != source.DataContext)
      {
          logic here
      }         
    }
    

    When you have the DataContext you can easy see if the sender is an item or the main listbox

提交回复
热议问题