DataGrid: Selecting a single row from a cell
This would select the whole row after selecting the cell
private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { DataGrid.HitTestInfo hti = dataGrid1.HitTest(e.X, e.Y); if (hti.Type == DataGrid.HitTestType.Cell) { dataGrid1.CurrentCell = new DataGridCell(hti.Row, hti.Column); dataGrid1.Select(hti.Row); POI temp = arrayListPOI[dataGrid1.CurrentRowIndex] as POI; FormPOI f = new FormPOI(temp); f.ShowDialog(); //MessageBox.Show("RowIndex is: " + dataGrid1.CurrentRowIndex + " POIID: " + temp.poi_id); } } |