I am using a DataGridView
, created using the designer with a few columns including a DataGridViewComboBoxColumn
column.
It is slightly irri
You can simply set EditMode property of your DataGridView
to EditOnEnter
.
It makes editing more easy. Almost single click, but if you want even when you click on content of combobox show dropdown for your ComboBoxColumn
immediately, you can handle CellClick event and then use EditingControl of your grid and cast it to DataGridViewComboBoxEditingControl and makes it to show dropdown.
private void categoryDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
//You can check for e.ColumnIndex to limit this to your specific column
var editingControl = this.categoryDataGridView.EditingControl as
DataGridViewComboBoxEditingControl;
if (editingControl != null)
editingControl.DroppedDown = true;
}
Be careful when using this trick, you may make drop downs annoying for users when they only want to navigate between cells without editing.