private void gridAttachments_MouseDown(object sender, MouseEventArgs e) { //A right click also needs to select an items so that the context menu will work properly. if (e.Button == MouseButtons.Right) { int clickedIndex = gridAttachments.PointToRow(e.Y); if (clickedIndex != -1) { gridAttachments.SetSelected(clickedIndex, true); } } }