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

GridListControl - re-sizing the entire control

I''m trying to make the total width of the dropdown narrower as it extends WAY past the edge of my form and doesn''t need to. In the CurrentCellShowingDropDown event, I''ve set the following widths : GridDropDownGridListControlCellRenderer.PopupControlContainer.PopupHost.Width GridDropDownGridListControlCellRenderer.PopupControlContainer.Width GridDropDownGridListControlPart.Width GridDropDownGridListControlPart.Grid.Width None of them are making any difference. How do I change the size of the dropdown? Thanks!

1 Reply

AD Administrator Syncfusion Team June 23, 2004 04:26 AM

Are you setting e.Size? Setting this event arg property in CurrentCellShowingDropDown is normally how the dropdown width is controlled. For ComboBoxes and GridListControl cells, you control the number of items displayed in the list by setting the DropDownRows property at some point (in CurrentCellShowingDropoDown is OK or you can do it in FormLoad if it is fixed grid-wide).
private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.ColIndex == 1 && cc.RowIndex == 23)
	{
		GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
		if(cr != null)
		{
		((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 3;
			cr.ListBoxPart.BackColor = Color.Blue;
		}
	}
	else if(cc.ColIndex == 1 && cc.RowIndex == 35)
	{
		GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
		if(cr != null)
		{
			((GridDropDownGridListControlPart)cr.ListControlPart).DropDownRows = 3;
			cr.ListControlPart.BackColor = Color.Blue;
			cr.ListControlPart.ShowColumnHeader = false;
		}
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon