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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Navigating drop-downs with up/down arrow keys

Thread ID:





39457 Jan 9,2006 02:16 PM UTC Jan 10,2006 12:12 PM UTC WinForms 3
Tags: GridControl
Nick Dalgiannakis
Asked On January 9, 2006 02:16 PM UTC

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.

stanleyj [Syncfusion]
Replied On 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

Nick Dalgiannakis
Replied On 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.

stanleyj [Syncfusion]
Replied On 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\\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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon