Setting a grid dropdown height

I have a dropdown in a grouping grid and I want the dropdown to resize depending and the number of items in the list. This is so all items will be displayed without the need for a vertical scroll bar.


1 Reply

AD Administrator Syncfusion Team April 24, 2008 10:56 AM UTC

Hi Shane,

This can be achieved by handled by the TableControlCurrentCellShowingDropDown event of GridGroupingControl. Please refer the code:


this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventHandler(gridGroupingControl1_TableControlCurrentCellShowingDropDown);



void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
if (cc.Renderer is GridComboBoxCellRenderer)
{
GridComboBoxCellRenderer dr = cc.Renderer as GridComboBoxCellRenderer;
((GridComboBoxListBoxPart)dr.ListBoxPart).DropDownRows = s.Count;
}
}



Please refer the sample:

http://www.syncfusion.com/support/user/uploads/GGC_combo_7b410857.zip



Regards,
Jisha


Loader.
Up arrow icon