I am using an UltraComboEditor with a set of ValueListItems where I have assigned an image to each Item. The image is a png of a 16x16 icon stylye image. I have set the combo value list with DisplayStyle.DisplayTextAndPicture. This will display the images and text correctly although the images are scaled down to the height of the text.
With ValueList.ScaleItemImage = ScaleImage.Never to force the item height to be scaled to accomodate the image, the DropDownBox shows a region of white space after the drop down items. The actual height of the DropDownBox appears normal but with scroll bars allowing the user to scroll past the end of the list. Selecting in this area seems to somewhat randomly select one of the items in the list
Are there any settings or methods to force the DropDownBox to recalculate the list size after populating items?
Hi,
I tried this out and I am not seeing the behavior you are describing. There's no extra space in the dropdown list in my test.
I'm attaching my sample project here. Try running it and see what happens.
If you run my sample and don't see the problem, then there must be some other factor at work in your application that is causing this issue.
If you run my sample and you see the same problem, then there must be something about the version of NetAdvantage on your machine that is causing this.
Hello Mike,
Thanks for the sample. It have modified it several times to narrow down the source of the odd behaviour. The sample as given does not show the drowdown sizing issue. If you add a null item with no image to allow the user to select null. The odd sizing is then shown.
this.ultraComboEditor1.Items.Add(null, "");
My combos are used with databinding to properties. I use the null item to allow the user to null the property.
thanks
Wendy
Hi Wendy,
Ah, that explains it. Once you add an item that has no image, the Combo will behave differently, because it now has variable-height items. Having items with different heights make it much more difficult (and expensive in terms of performance) for the control to calculate the total height needed.
What I would do is create a blank 16x16 image and assign it to the null item. That way all the items will have the same size image and it will correct the scrolling issue and make the control more efficient.
I tried setting the ItemHeight and it also corrects the scroll box sizing issue.
In our case, the earlier solution adding a null image provides greater flexibility for various application styling for fonts, etc. For the null item, I simply added the line
vli.Appearance.Image = new Bitmap(16, 16);
Thanks,
It occurred to me that there is also another way to solve this problem which is even easier. So if you don't want to overhead of creating an extra image, you could do this:
this.ultraComboEditor1.ValueList.ItemHeight = 16;
Hi Mike
I added the blank image and it's corrected the scroll issue.