WPF ListView ScrollViewer Double-Click Event

后端 未结 4 965
予麋鹿
予麋鹿 2021-01-19 07:48

Doing the below will reproduce my problem:

  • New WPF Project
  • Add ListView
  • Name the listview: x:Name=\"lvList\"
  • Add enough ListViewItem
4条回答
  •  醉梦人生
    2021-01-19 08:36

    Maybe this helps?

    Private Sub LstView_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles LstView.MouseDoubleClick
        Dim source As FrameworkElement = TryCast(e.OriginalSource, FrameworkElement)
        If IsNothing(source) Then Return
    
        Dim TmplParent As DependencyObject = TryCast(source.TemplatedParent, DependencyObject)
        If IsNothing(TmplParent) Then Return
        If Not TmplParent.GetType.Equals(GetType(System.Windows.Controls.ListViewItem)) Then e.Handled = True
    End Sub
    

提交回复
热议问题