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

Set MaxDropDownItems for Combobox in Grid

Hi,

I am using the following code to display a combox in a grid:

cellStyle.CellType = GridCellTypeName.ComboBox;
cellStyle.ChoiceList = new System.Collections.Specialized.StringCollection();
cellStyle.ChoiceList.AddRange(values);

where cellStyle is of type GridStyleInfo.

How can I set the property MaxDropDownItems of the combobox, so that no scrollbars are display. Currently it seems to be set to 5.

Thanks

1 Reply

JJ Jisha Joy Syncfusion Team July 9, 2010 10:33 AM UTC

Hi Knebel,

Thank you for using Syncfusion products.

The number of items to be displayed in dropdownpart while combobox is dropped down, can be set through the DropDownRows property of ListBoxPart in the GridComboBoxCellRenderer class.

Refer the code below:

GridComboBoxCellRenderer rend = this.gridControl1.Model.CellRenderers["ComboBox"] as GridComboBoxCellRenderer;
GridComboBoxListBoxPart lbpart = rend.ListBoxPart as GridComboBoxListBoxPart;
lbpart.DropDownRows = 10;

This code gets the renderer object of the combobox cells in grid and assigns the dropdownrows count to 10. Now, on dropping down the combobox, 10 items can be viewed at a time without a need to scroll.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon