We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Navigating drop-downs with up/down arrow keys

Is there a built-in way of using up/down arrow keys to navigate through the choice list in a drop-down cell, rather than moving to another cell? I''ve tried the following code: private void grid_CurrentCellKeyDown(object sender, KeyEventArgs e) { if ( (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) && gccs.ChoiceList != null && !gcc.IsDroppedDown) { this.CurrentCell.ShowDropDown(); e.Handled = true; }} This will bring up the drown-down list the first time the user hits up/down key, and then up/down events are trapped by the underlying combo-box control (thus giving me the behavior I want). However, with dropDownStyle=AutoComplete, it seems that if no text is entered in the cell and there is a blank entry in the choiceList (i.e. empty string), the up/down keys will no longer work. Is this expected or is it a bug? Thanks for your help.

3 Replies

ST stanleyj Syncfusion Team January 9, 2006 02:58 PM UTC

Hi Nick, I am not sure if you have tried ALT+Down, that shows the dropdown and then with up/down keys the contents in the dropdown list can be navigated. However if the ChoiceList is empty then the dropdown does not open as there is nothing. Let me know if you trying something different. Note; F4 and Alt-Down will dropdown/close up a cell. This feature may not be available in the lower versions. Best regards, Stanley


ND Nick Dalgiannakis January 10, 2006 10:34 AM UTC

Thanks for your reply. Didn''t know about the ALT+Down trick - that effectively does what I wanted to do by just using the Down key (without ALT). The problem, however, is that if one of the strings in the choiceList StringCollection is "" (i.e. empty string) and the user has typed no text in the cell and starts navigating the drop down list, if he selects "" from the list, he can no longer navigate with up/down keys unless he re-opens the drop down list. Any work-around for this? Also, if I wanted to generally override some of the behavior of the drop-down cell type, would I be better off extending the drop-down renderer class and implementing my logic there? If so, how would I link my renderer to the StyleInfo.CellType property? Thanks again for your help.


ST stanleyj Syncfusion Team January 10, 2006 12:12 PM UTC

Hi Nick, I could see that the navigation is struck or in other words returns to top after reaching empty string. Placing a space('' '') instead of empty string('''') works. A custom CellType can be created, it requires a model class and a renderer class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell. This sample in \Syncfusion\Essential Studio\4.1.0.10\windows\Grid.Windows\Samples\In Depth\DerivedCellControlTutorial can be referred. After creating the custom celltype, it has to be registered through CellModels.Add grid.Model.CellModels.Add("MyCellType", new GridMyCellModel(grid.Model)); Then you may use Style.CellType = "MyCellType"; By overriding GridComboBoxCellModel and GridComboBoxCellRenderer, combo box can be modified. Best regards, Stanley

Loader.
Live Chat Icon For mobile
Up arrow icon