3
有沒有更好的方法來確定用戶在數據網格中雙擊的行?WPF:DataGrid單元格雙擊
Private Sub ResultsGrid_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
Dim node As DependencyObject = CType(e.OriginalSource, DependencyObject)
Do Until TypeOf node Is Microsoft.Windows.Controls.DataGridRow OrElse node Is Nothing
node = VisualTreeHelper.GetParent(node)
Loop
If node IsNot Nothing Then
Dim data = CType((CType(node, Microsoft.Windows.Controls.DataGridRow)).DataContext, Customer)
'do something
End If
End Sub