Before anyone marks this as duplicate, plz note that this is not the same as the questions asked here, here and here.
When you have two or more DataGridViewComboBoxColumn
s in your DataGridView
and one of them has its dropdown currently open, clicking on the dropdown button of a different column does not open that dropdown. Instead you still have to click twice. First click is consumed in hiding the already open dropdown and the second click actually opens the dropdown on which you click.
Note that two clicks are required when EditOnEnter
mode is ON; else you'll have to perform three clicks to get this done. I have tried ContentClick event too, without any gain.
So how can I use one-click operation in cases when I have more than one DataGridViewComboBoxColumn
in my grid?
Update
Just in case anyone wants to reproduce it, here is the process:
- Create a new WinForms C# project.
Go to Form1's code and paste this in the constructor after the InitializeComponent
line:
DataGridView dgv = new DataGridView();
DataGridViewComboBoxColumn col1 = new DataGridViewComboBoxColumn();
DataGridViewComboBoxColumn col2 = new DataGridViewComboBoxColumn();
dgv.Columns.AddRange(new DataGridViewColumn[] { col1, col2 });
dgv.Dock = DockStyle.Fill;
dgv.EditMode = DataGridViewEditMode.EditOnEnter;
col1.Items.AddRange(new object[] { "Cat", "Dog", "Elephant", "Lion" });
col2.Items.AddRange(new object[] { "Duck", "Hen", "Crow", "Sparrow" });
this.Controls.Add(dgv);
Run the project. Click on the first drop-down, then click on the other dropdown without closing the first one. It will take 2 or 3 clicks (depending upon where you click in the second dropdown) to get the second list opened.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…