This is a migrated thread and some comments may be shown as answers.

ComboBox Width

8 Answers 272 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 27 Mar 2008, 01:55 PM
Hi,

Is there are simple way with RadComboBox to set the width of the combo to the pixel size of the width of the longest item currently in the dropdown?  This would apply to both the combobox itself and the dropdown.

Thanks,

8 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 28 Mar 2008, 03:41 PM
Hello Jonathan,

Currently RadComboBox does not support this feature, but it has already been logged in our To-Do list.

I hope that this is not a major show-stopper for you.

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
ChrisS
Top achievements
Rank 1
answered on 17 Jun 2008, 01:52 PM
Hi,

Does anyone know whether this feature is now supported?

Many thanks

Alistair
0
Simon
Telerik team
answered on 18 Jun 2008, 03:28 PM
Hi Chris Studman,

This feature is not supported by RadComboBox, yet.

We have encountered certain difficulties in its implementation and are still researching to find the best approach. A time frame on when it will be introduced is unavailable at the moment.



Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Matthew
Top achievements
Rank 1
answered on 02 Oct 2008, 08:54 PM
Bump: is this supported in build 1001?
0
Simon
Telerik team
answered on 03 Oct 2008, 01:26 PM
Hi Matthew Howell,

Unfortunately this feature is not yet part of the functionality of RadComboBox. On the other hand, if we receive enough customer requests for the feature perhaps we can include it in our TODO list.

However you could always use an approach like the shown below to achieve the desired effect:

[C#]
int maxWidth = 0; 
 
foreach (RadComboBoxItem item in RadComboBox1.Items)  
{  
    int itemLength = item.Text.Length;  
     
    if (itemLength > maxWidth)  
    {  
        maxWidth = itemLength;  
    }  
 
RadComboBox1.DropDownWidth = maxWidth * 7;  

[VB.NET]
Dim maxWidth As Integer = 0 
 
For Each item As RadComboBoxItem In RadComboBox1.Items 
    Dim itemLength As Integer = item.Text.Length 
 
    If itemLength > maxWidth Then 
        maxWidth = itemLength 
    End If 
Next 
 
RadComboBox1.DropDownWidth = maxWidth * 7 

I hope this helps.

Best wishes,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Martin de Ruiter
Top achievements
Rank 2
answered on 03 Oct 2008, 03:15 PM
I support this feature as well, I hope it can be added to the TODO list. Ideally it would support boundary detection too, just like the combobox height.
0
Matthew
Top achievements
Rank 1
answered on 07 Jan 2009, 01:11 PM
I use this method, but it adds the scrollbars to the dropdown. When I just hardcoded the widths, the scrollbars are added. Is there a way to remove the scrollbars (rcbScroll)?
0
Pieter
Top achievements
Rank 1
answered on 06 Feb 2009, 05:14 PM
Same problem with both horizontal and vertical scrollbars added to combobox when hardcoding the size of the list in IE. In Firefox this doesn't give this problem.
Tags
ComboBox
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Simon
Telerik team
ChrisS
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Martin de Ruiter
Top achievements
Rank 2
Pieter
Top achievements
Rank 1
Share this question
or