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.
Unfortunately, activation email could not send to your email. Please try again.

GridComboBoxCellRenderer ListBoxPart Size

Thread ID:

Created:

Updated:

Platform:

Replies:

60873 May 14,2007 11:35 AM May 15,2007 04:35 PM Windows Forms 3
loading
Tags: GridControl
Tom
Asked On May 14, 2007 11:35 AM

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

haneefm [Syncfusion]
Replied On May 14, 2007 11:59 AM

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

Tom
Replied On May 15, 2007 02:30 AM

Hi Haneef,

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

Cheers,
Tom

haneefm [Syncfusion]
Replied On May 15, 2007 04:35 PM

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

CONFIRMATION

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.

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.

;