private void grdSeen_MouseUp(object sender, MouseEventArgs e) { DataGrid.HitTestInfo hti = this.grdSeen.HitTest(e.X, e.Y); const int seenColumn = 0; const int nameColumn = 1; const int countColumn = 2; try { switch(hti.Type) { case DataGrid.HitTestType.Cell: { this.grdSeen.Select(hti.Row); switch (hti.Column) { case seenColumn: { this.SetData(hti.Row, hti.Column, (ChecklistItemDataSet.CheckListItemRow)_dtItem.Rows[hti.Row]); this.grdSeen.CurrentCell = new DataGridCell(hti.Row, hti.Column - 2); break; } case nameColumn: { // move off row so name highlights as selected row. this.grdSeen.CurrentCell = new DataGridCell(hti.Row, hti.Column - 1); break; } case countColumn: { if (!Convert.ToBoolean(_dtItem.Rows[hti.Row]["Seen"])) { //if it hasn't been marked seen, mark it and record data this.SetData(hti.Row, hti.Column, (ChecklistItemDataSet.CheckListItemRow)_dtItem.Rows[hti.Row]); } else { //just incrmeent the count. this.IncrementCount((ChecklistItemDataSet.CheckListItemRow)_dtItem.Rows[hti.Row]); } this.grdSeen.CurrentCell = new DataGridCell(hti.Row, hti.Column); break; } } break; } case DataGrid.HitTestType.ColumnHeader: { break; } } } catch(Exception ex) { MessageBox.Show(ex.ToString()); } }