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
close icon

How do I programmatically scroll thru a combobox in a cell?

I have a GridControl with a ColumnStyle whose CellType is set to "CombobBox". The DataSource for the combobox column is set to a collection of objects. Is it possible to programmatically scroll up or down through the values?

2 Replies

ST stanleyj Syncfusion Team February 17, 2006 01:22 PM UTC

Hi Don, see if Style.DropDownStyle = GridDropDownStyle.AutoComplete helps. If the dropdown is to be dropped on changing values, then use this code to show the dropdown. private void gridDataBoundGrid1_CurrentCellChanged(object sender, System.EventArgs e) { GridComboBoxCellRenderer renderer = this.gridDataBoundGrid1.CurrentCell.Renderer as GridComboBoxCellRenderer; if(this.gridDataBoundGrid1.CurrentCell.Renderer.StyleInfo.CellType == "ComboBox") { this.gridDataBoundGrid1.CurrentCell.ShowDropDown(); } } The above idea is to scroll the value when editing. If your requirement is different and you need to locate the selected index programmatically, then see if this piece of information helps. The ComboBox CellType uses the ListBox for the dropdown and button is derived from GridCellButton and ComboBox is not directly implemented. The ListBox can be handled through the ListBoxPart to the instance of theGridComboBoxCellRenderer. this.gridDataBoundGrid1.Focus(); this.gridDataBoundGrid1.CurrentCell.MoveTo(3,2); // ComboBox cell this.gridDataBoundGrid1.CurrentCell.ShowDropDown(); GridComboBoxCellRenderer renderer = this.gridDataBoundGrid1.CurrentCell.Renderer as GridComboBoxCellRenderer; renderer.ListBoxPart.SelectedIndex = i; // to select programmatically Best regards, Stanley


MS Maxim Software Systems February 17, 2006 03:25 PM UTC

Thanks for the info. I managed to get the functionality I needed by grabbing the existing value of the cell and using my custom collection class to determine what the previous/next value should be, then setting that new value back into the cell. But hopefully what you''ve posted will help someone else in the future.

Loader.
Live Chat Icon For mobile
Up arrow icon