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

ComboBox List Count

Thread ID:





57114 Feb 26,2007 05:35 PM UTC Feb 26,2007 07:58 PM UTC WinForms 3
Tags: GridControl
Kyle DeVoe
Asked On February 26, 2007 05:35 PM UTC

I need to increase the number of items that are displayed when the user clicks and opens a combobox. Currently the default is six items. I assume there is a way to change the default number of items that are listed. How do I do this?


Administrator [Syncfusion]
Replied On February 26, 2007 05:47 PM UTC

Hi Kyle,

Here is a minimal sample that shows you "How to increase the display item count in a combobox cell?".

Best regards,

Kyle DeVoe
Replied On February 26, 2007 07:11 PM UTC


Thank you for the example. I tried the example and it doesn't fit my needs. I'll try to explain it again, because I don't think I explained it well.

When a user clicks a button to display the list box, the drowp down list will show up to six items from the list. If you have less than six in the list, then obviously it shows the entire list. If you have more, it shows only six, but displays a scrollbar to view the rest of the list. How do I increase the subset of items listed when the drop down displays?

Kyle DeVoe
Replied On February 26, 2007 07:58 PM UTC

I found my answer. I figured I would have to override CurrentCellShowingDropDown() to fix the issue. I was then able to search the documentation until I found a topic called "How to Control the Number of Visible Items in a Combo Box Cell".

How to Control the Number of Visible Items in a Combo Box Cell


There is a GridComboBoxListBoxPart.DropDownRows property which, you can set to control this. The GridComboBoxListBoxPart is the actual control type of the list that is dropped to display the items. But, it is buried a little deep and generally needs an event handler to set it. The reason of using an event handler is that normally a single combobox control is shared among all combobox cells. Each cell can potentially have a different list and may need different numbers of visible rows. So to handle this, you must catch the Grid.CurrentCellShowingDropDown event and set the property there depending upon the exact row and column.



private void grid_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)

GridControlBase grid = sender as GridControlBase;
if(grid != null)
GridCurrentCell cc = grid.CurrentCell;
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;

// Set number of visible items for comboboxes in Row 6 as 4, Row 4 as 7, Row 2 as 10 , and so on.
if(cc != null)
if(cc.RowIndex == 6)
((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 4;
else if(cc.RowIndex == 4)
((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 7;
else if(cc.RowIndex == 2)
((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 10;
else ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 6;

Private Sub Grid_CurrentCellShowingDropDown(sender As Object, e As GridCurrentCellShowingDropDownEventArgs)
Dim grid As GridControlBase = sender
Dim cc As GridCurrentCell = grid.CurrentCell
If cc.Renderer Is GetType(GridComboBoxCellRenderer) Then
Dim cr As GridComboBoxCellRenderer = cc.Renderer

// Set number of visible items for comboboxes in Row 6 as 4, Row 4 as 7, Row 2 as 10 , and so on.
If cc.RowIndex = 6 Then
CType(cr.ListBoxPart, GridComboBoxListBoxPart).DropDownRows = 4
ElseIf cc.RowIndex = 4 Then
CType(cr.ListBoxPart, GridComboBoxListBoxPart).DropDownRows = 7
ElseIf cc.RowIndex = 2 Then
CType(cr.ListBoxPart, GridComboBoxListBoxPart).DropDownRows = 10
CType(cr.ListBoxPart, GridComboBoxListBoxPart).DropDownRows = 6
End If
End If
End Try
End Sub


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