Possible Dupl开发者_如何学Goicate:
Open dropdown(in a datagrid view) items on a single click
We have a DataGridView where one column is a ComboBox with the DropDownButton style. The DataGridView is in FullRowSelect mode. Let's assume that I have 5 rows, and row 0 is selected in the DataGridView.
I want to select an item from the ComboBox of -say for example- row 2, therefore I click the little arrow of the ComboBox. When I do this, first, row 2 of the DataGridView is selected. The ComboBox does not open yet. Only the second click opens the ComboBox.
In fact, it used to require 3 clicks, but then we overloaded the CellMouseDown to do:
myDataGridView.ClearSelection();
myDataGridView.Rows[e.RowIndex].Selected = true;
With this, we're down to 2 clicks. Is there a way to show the ComboBox items with one click only?
Edit: I should also mention that, instead of clicking on the little arrow of the ComboBox, if I click the ComboBox itself, it takes 3 clicks to show the ComboBox items!
Set your DataGridView's EditMode property to EditOnEnter
Actually it first focus or select the cell, and then on second click it opens the dropdown. To solve this issue, check this link.
精彩评论