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

Setting width of GridListControl in ComboboxExt

Hi, I have a comboboxext with a grid list control (GLC) as the drop down listcontrol. My GLC have 3 or 4 columns. I want to have all my columns visible completely when dropped down. I could use combo.DropDownWidth to set the size. But how do I know how much it is? thanks, - Reddy

3 Replies

AD Administrator Syncfusion Team August 13, 2003 04:22 PM UTC

One thing to try is int width = this.glc.Grid.Model.ColWidths.GetTotal(0,this.glc.Grid.Model.ColCount); to see if that will give you the size you need. You might need to turn off the FillRightColumn property as this may conflict with trying to explicilty size things.


AD Administrator Syncfusion Team August 13, 2003 04:32 PM UTC

Clay, This is not taking the vertical scrollbar into consideration. How do I get the vertical scrollbar size? FYI, some how the GLC in GLC Grid cell type is sized exactly. I want to do the same thing for my combobox in a panel. thanks, - Reddy


AD Administrator Syncfusion Team August 13, 2003 05:36 PM UTC

Here is the code the DropDown GridListControl uses.
int sbWidth = grid.VScroll ? SystemInformation.VerticalScrollBarWidth : 0;
int width = grid.ColWidths.GetTotal(0, grid.ColCount)+2;
if (width < grid.Width-sbWidth)
	grid.ColWidths[grid.ColCount] += grid.Width-sbWidth-width;               
sbWidth is the scrollbar width, width is the sum of the colwidths with a +2 fudge factor (for borders). This +2 might be what the previous code was missing. The if statement hadles the case when the sum of the columns is less than teh client width. In that case it makes teh right column the exact size to fill the client width.

Loader.
Live Chat Icon For mobile
Up arrow icon