WPF: DataGrid Cell Double-click
        Posted  
        
            by Jonathan Allen
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jonathan Allen
        
        
        
        Published on 2010-03-03T02:32:59Z
        Indexed on 
            2010/03/19
            22:31 UTC
        
        
        Read the original article
        Hit count: 1338
        
wpf
|wpftoolkit
Is there a better way than this to determine the row a user double-clicked on in a data-grid?
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
© Stack Overflow or respective owner