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

Grid Cell Drop Down Height/Width Change

If I have a Cell with a Drop Down Combo in it how can I change the width and height of the drop down when it visible?

12 Replies

AD Administrator Syncfusion Team June 29, 2005 02:49 PM UTC

To control the height, you set the DropDownRows property in the CurrentCellShowingDropDown event as below:
GridCurrentCell cc = grid.CurrentCell;
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
if(cc != null)
{
	GridComboBoxListBoxPart listBoxPart = (GridComboBoxListBoxPart)cr.ListBoxPart;
	listBoxPart.DropDownRows = yourMaxItemCount;
}
To control the width, you set e.Size = new Size(desiredWidth, e.Size.Height); in teh same event.


NZ Nick Zdunic June 30, 2005 05:24 AM UTC

It would also be good to make it user sizeable by dragging the right corner of the drop down. Is this possible? - Probably by supplying my own drop down control to replace the standard one. >To control the height, you set the DropDownRows property in the CurrentCellShowingDropDown event as below: >
>GridCurrentCell cc = grid.CurrentCell;
>GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
>if(cc != null)
>{
>	GridComboBoxListBoxPart listBoxPart = (GridComboBoxListBoxPart)cr.ListBoxPart;
>	listBoxPart.DropDownRows = yourMaxItemCount;
>}
>
> >To control the width, you set > >e.Size = new Size(desiredWidth, e.Size.Height); > >in teh same event.


AD Administrator Syncfusion Team June 30, 2005 08:09 AM UTC

We do not have support for user sizing of the droplists. If you need this, then you would have to derive your own celltypes to manage this. Our ComboBox CellType uses a Windows Forms ListBox object as its droplist. That object also does not support user sizing. So, one try at this would be to derive GridComboBoxListBoxPart (which is the ListBox derived class that the grid actually uses as its droplist) to support user sizing. Then derive our ComboBox celltype. In the renderer class, you would override CreateListBoxPart where you would create and pass back an instance of your sizable listbox.


NZ Nick Zdunic June 30, 2005 09:26 AM UTC

Any chance of a working sample showing this sort of code? >We do not have support for user sizing of the droplists. > >If you need this, then you would have to derive your own celltypes to manage this. > >Our ComboBox CellType uses a Windows Forms ListBox object as its droplist. That object also does not support user sizing. So, one try at this would be to derive GridComboBoxListBoxPart (which is the ListBox derived class that the grid actually uses as its droplist) to support user sizing. Then derive our ComboBox celltype. In the renderer class, you would override CreateListBoxPart where you would create and pass back an instance of your sizable listbox.


AD Administrator Syncfusion Team June 30, 2005 10:17 AM UTC

It will be later next week sometime before we can get to this.


NZ Nick Zdunic June 30, 2005 03:38 PM UTC

Ok - it would be good to see that sample. Just also, I think this is possible, to also format each item in the list box diffrently. e.g. some items bolded, some italics, some underlined and some a combination of that. I think that is some sort of owener drawn capability in .NET but I haven''t tried it myself. >It will be later next week sometime before we can get to this.


AD Administrator Syncfusion Team July 6, 2005 01:33 PM UTC

Here is a sample link for allowing the dropdown to be user sizable. http://www.syncfusion.com/Support/user/uploads/DynamicDropDown_81dfde0a.zip A couple of things. There is a real estate problem with respect to the scrollbar. So, I put the sizing hotspot in the lower right corner. The other point is that the height sizing is not continuous and is set by setting ((GridComboBoxListBoxPart)this.ListBoxPart).DropDownRows property from teh renderer. I did not try to handle this, so teh sizing only affects the width.


NZ Nick Zdunic July 7, 2005 04:24 PM UTC

Good, except in the sample the bound list items are not being drwan in the list. Does using v2.0.5.1 make a difference? >Here is a sample link for allowing the dropdown to be user sizable. > >http://www.syncfusion.com/Support/user/uploads/DynamicDropDown_81dfde0a.zip > > >A couple of things. There is a real estate problem with respect to the scrollbar. So, I put the sizing hotspot in the lower right corner. > >The other point is that the height sizing is not continuous and is set by setting ((GridComboBoxListBoxPart)this.ListBoxPart).DropDownRows property from teh renderer. I did not try to handle this, so teh sizing only affects the width. >


AD Administrator Syncfusion Team July 7, 2005 04:53 PM UTC

I do not see this problem using 3.2.1.0. Here is what I see as I size the window (cursor is not shown in the snapshot.) http://www.syncfusion.com/Support/user/uploads/dynamicDD_c08c3270.zip


NZ Nick Zdunic July 7, 2005 08:01 PM UTC

My screen shot shows that the items do not appear. This is running your sample against 2.0.5.1 The upload is not working so please take my word for it - otherwise I can email you the screen shot. Can you try against this version to verify. >I do not see this problem using 3.2.1.0. >Here is what I see as I size the window (cursor is not shown in the snapshot.) > >http://www.syncfusion.com/Support/user/uploads/dynamicDD_c08c3270.zip >


AD Administrator Syncfusion Team July 7, 2005 10:22 PM UTC

I installed the 2051 DLLs. The entries do not show up with those DLLs for me either. They do show up with the current release, 3.2.1.0.


NZ Nick Zdunic July 8, 2005 06:55 AM UTC

Oh well - I''ll drop the feature then. Not hugely important and everything else works fine anyway. Thanks for the sample anyway. >I installed the 2051 DLLs. The entries do not show up with those DLLs for me either. They do show up with the current release, 3.2.1.0.

Loader.
Live Chat Icon For mobile
Up arrow icon