|
this.gridControl1.SelectionChanging += GridControl1_SelectionChanging;
this.gridControl1.CellButtonClicked += GridControl1_CellButtonClicked;
//To identify the control key is pressed or not.
this.gridControl1.KeyDown += GridControl1_KeyDown;
bool isDropDownButtonClicked = false;
bool isControlPressed = false;
private void GridControl1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == (Keys.ControlKey | Keys.Control))
{
isControlPressed = true;
}
}
private void GridControl1_CellButtonClicked(object sender, GridCellButtonClickedEventArgs e)
{
if (e.ColIndex == 5 && isControlPressed)
{
isDropDownButtonClicked = true;
//To select the row
this.gridControl1.Selections.Add(GridRangeInfo.Row(e.RowIndex));
isControlPressed = false;
}
}
private void GridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
GridCurrentCell currentCell = this.gridControl1.CurrentCell;
if (currentCell.ColIndex == 5 && isDropDownButtonClicked)
{
e.Cancel = true;
isDropDownButtonClicked = false;
}
} |