How to make combo box open when clicking the arrow button

May 15, 2009 at 10:46 PM
Edited May 15, 2009 at 11:00 PM

I have several combo boxes in my grid.  I set the style to DropDownList and set the editable mode to single click, any key, focus.

When you click in the cell or on the arrow button, the value becomes highlighted but the dropdown does not open.  Is there any way to get the dropdown to open the first time the arrow button is clicked?

riskEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string), RISK_VALUES, false);

riskEditor.EnableEdit = view.UserPrivledge != UserData.PrivledgeType.ReadOnly && view.UserPrivledge != UserData.PrivledgeType.Developer;

riskEditor.EditableMode = EditableMode.SingleClick | EditableMode.AnyKey | EditableMode.Focus;

riskEditor.Control.DropDownStyle = ComboBoxStyle.DropDownList;

May 16, 2009 at 1:00 PM

That's just a guess, but maybe you can create a custom controller and on "cellClick" or some other event can open your combo box programatically?

May 21, 2009 at 8:14 AM

I have the same problem ,i tried to do it .

in ShowControl()

Point mousePoint = Control.PointToClient(Grid.MousePosition);

Rectangle btnRect = new Rectangle(Control.Width - 20, 0, Control.DropDownWidth, Control.Height);

if (btnRect.Contains(mousePoint))

Control.DroppedDown = true;

May 22, 2009 at 3:28 PM

I found an easy way to do it.

Rather than changing SourceGrid code, I added some code to my existing mouseDown handler for the grid.  If the cell under the mouse is in the column with checkboxes, I send 'F4' to the cell.

if (grid.MouseCellPosition.Column == columnwithcheckbox)


Unfortunately, ComboBoxes are a cell type rather than their own type like CheckBoxes.  I didn't find an easy way to determine if the cell was a combobox in my code so I had to check for the specific column.

Hope this helps.