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

Changing height of custom ListBox in ComboBoxBarItem

Hi, Could you please tell me how to change the initial height of a ComboBoxBarItem's custom ListBox? It always seems to create with the same height (of approximately 80 pixels). I would like to size my custom ListBox to fit the items. Thanks, Sue

6 Replies

RP Ramesh Praveen Syncfusion Team July 18, 2003 09:51 AM

The ComboBoxBarItem has a MaxDropDownItems property that will let you change the height. Regards, Praveen


SH Sue Harris July 20, 2003 01:48 PM

The MaxDropDownItems seems to have no effect when using a customer listbox, only when using the internal listbox. Do you have any other suggestions?


RP Ramesh Praveen Syncfusion Team July 22, 2003 01:16 PM

I tested this in our XPMenus sample and this does seem to work in the fontComboBoxBarItem (in the TextEditorForms.cs). Regards, Praveen


SH Sue Harris July 27, 2003 04:49 PM

It mostly works in the sample you suggested, but if the MaxDropDownItems is less than 4, it doesn't appear to work correctly. I have attached a sample which I'm experiencing the problem in. It has three combo box bar items, the first only has 3 items (and a MaxDropDownItems of 6), and I want to be able to set the height to only display the 3 items (exclude the white space below). Nothing I've tried will remove the white space. The second has several items, and the MaxDropDownItems of 3, and it is drawing 5.5 items. The last combo box bar item appears to work correctly. Regards, Sue


RP Ramesh Praveen Syncfusion Team July 28, 2003 07:49 PM

Hi, It seems that there is a 75 pixel minimum height requirement for the dropdown hard coded in source. I have discussed with our developers and we will remove this in our next release. I will notify you. Sorry for the inconvenience. Regards, Praveen


SH Sue Harris July 31, 2003 07:54 PM

Thanks, Although I'm still going to be waiting for that fix, I have found a workaround for anyone else experiencing the same problem. In the ListBox's OnVisibleChanged event: private void listBox1_VisibleChanged(object sender, EventArgs e) { if ( this.Visible ) { int newHeight = this.listBox1.ItemHeight * Math.Min(this.comboBoxBarItem1.MaxDropDownItems, this.listBox1.Items.Count); if ( ( this.listBox1.Parent != null ) && (this.listBox1.Parent.Parent != null) ) { this.listBox1.Parent.Parent.Height = newHeight; this.listBox1.Parent.Height = newHeight; this.listBox1.Height = newHeight; } } }

Loader.
Live Chat Icon For mobile
Up arrow icon