Hallo Peter,
hitTest dürfte das sein, was du suchst. Hier ein Beispiel aus der Hilfe:
//den Event zuweisen
this.theGrid.MouseUp += new System.Windows.Forms.MouseEventHandler(this.theGrid\_MouseDown);
Private Sub theGrid\_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim myGrid As DataGrid = CType(sender, DataGrid)
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo
hti = myGrid.HitTest(e.X, e.Y)
Select Case hti.Type
Case System.Windows.Forms.DataGrid.HitTestType.None
Console.WriteLine("You clicked the background.")
Case System.Windows.Forms.DataGrid.HitTestType.Cell
Console.WriteLine("You clicked cell at row " & hti.Row & ", col " & hti.Column)
Case System.Windows.Forms.DataGrid.HitTestType.ColumnHeader
Console.WriteLine("You clicked the column header for column " & hti.Column)
Case System.Windows.Forms.DataGrid.HitTestType.RowHeader
Console.WriteLine("You clicked the row header for row " & hti.Row)
Case System.Windows.Forms.DataGrid.HitTestType.ColumnResize
Console.WriteLine("You clicked the column resizer for column " & hti.Column)
Case System.Windows.Forms.DataGrid.HitTestType.RowResize
Console.WriteLine("You clicked the row resizer for row " & hti.Row)
Case System.Windows.Forms.DataGrid.HitTestType.Caption
Console.WriteLine("You clicked the caption")
Case System.Windows.Forms.DataGrid.HitTestType.ParentRows
Console.WriteLine("You clicked the parent row")
End Select
End Sub
Falls du die Tabelle sortierst must du aus dem View noch in die Tabelle „übersetzen“, da die Zeilennummer im DataGrid dann nicht der Zeile in der Tabell entspricht. Genaueres bei Bedarf …
mfg
Dirk.Pegasus