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

GridComboBoxCellRenderer ListBoxPart Size

Hi,

I have a derived cell from GridComboBoxCellModel and Renderer. How can I set the ListBoxPart size in the renderer. I didn't find a solution wich works. It seems a size change doesn't have any influence on the listbox at all.

Cheers,
Tom

PS: I am using a GGC

3 Replies

HA haneefm Syncfusion Team May 14, 2007 03:59 PM UTC

Hi Tom,

You can override the OnShowingDropDown method and set e.Size to new size. And also you control the number of items displayed in the list by setting the DropDownRows property at some point in OnShowingDropoDown.

private void OnShowingDropDown(GridCurrentCellShowingDropDownEventArgs e)
{
e.Size = new Size(400,400);
((GridDropDownGridListControlPart) cr.ListControlPart).DropDownRows = 2;
}

Best regards,
Haneef


TO Tom May 15, 2007 06:30 AM UTC

Hi Haneef,

I am not sure, but the GridComboBoxCellRenderer class doesn't have a OnShowingDropDown method.
Any ideas?

Cheers,
Tom


HA haneefm Syncfusion Team May 15, 2007 08:35 PM UTC

Hi Tom,

Sorry for the inconvenience caused. You can override the OnShowDropDown method in derived GridComboBoxCellRenderer class. Below is a code snippet

public class MyComboBoxCellRenderer : GridComboBoxCellRenderer
{
public MyComboBoxCellRenderer(GridControlBase grid, GridCellModelBase cellModel): base(grid, cellModel)
{this.SupportsFocusControl = false; }

protected override void OnShowDropDown()
{
base.OnShowDropDown ();
this.ListBoxPart.Size = new Size(50,400); //Setting the Width
((GridComboBoxListBoxPart)this.ListBoxPart).DropDownRows = 4; //Setting the Height
}
}

Please try the attached sample and let me know if this helps.
ComboBox.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon