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

Drop down width problem

5 Answers 152 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sameer Pahuja
Top achievements
Rank 1
Sameer Pahuja asked on 13 May 2009, 06:33 AM

i have a ComboBox with some items in it (width pf combo cox 162), when i start application and click on the combobox, the drop down expands with width of about 180 px. If i click again on the combobox, the drop down expands but has a correct width of 162 px.

i have used statements like:

this.radComboBox1.DropDownWidth = 162;

 

or

 

radComboBox1.DropDownMaxSize = radComboBox1.Size;
or

radComboBox1.DropDownMinSize = radComboBox1.Size;

but still i am getting the same problem.

Can you please suggest me some solution?

5 Answers, 1 is accepted

Sort by
0
Accepted
Nick
Telerik team
answered on 13 May 2009, 12:34 PM
Hi Sameer Pahuja,

Thank you for contacting us. We are aware of a similar issue. Currently there is no work-around for the issue we know but we will be glad to review your case in detail and if different see whether we can think of some work-around for your scenario. Please send us a sample project reproducing the issue and please open a new support ticket so that you can attach files. Thank you very much in advance.

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sameer Pahuja
Top achievements
Rank 1
answered on 14 May 2009, 10:54 AM
Dear Nick,

Thanks for the reply, i just want to put your attention to a similar issue in raddropdownmenu button, it has width let us suppose 30 px, but the dropdown box has width more than 40 px by default.
in my application i want the width of dropdown box same as width of button i.e. 30 px.
I am not able to change it manually, Can u please gime sum soln to handle this issue?
0
Nick
Telerik team
answered on 14 May 2009, 11:26 AM
Hello Sameer Pahuja,

Thank you for writing us back. You can use the following code:

void radDropDownButton1_DropDownOpening(object sender, EventArgs e) 
            int width = this.radDropDownButton1.Size.Width; 
            this.radDropDownButton1.DropDownButtonElement.DropDownMenu.MinimumSize = new Size(width, 0); 
            this.radDropDownButton1.DropDownButtonElement.DropDownMenu.MaximumSize = new Size(width, 1000);             
 

You need to subscribe to drop down opening event. Then you can set explicitly the minimum and maximum size of the drop down.

I hope that this helps. Do not hesitate to write me back if you have more questions.

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sameer Pahuja
Top achievements
Rank 1
answered on 15 May 2009, 04:12 AM
Dear Nick,

Thanks for the reply, Ur solution is doing quite good but the problem here is, the text has been been cut from last.
I have some text in dropdown, after applying this solution, certainly width of dropdown has become equal to button width, but the text from last is not visible.

please suggest me some solution to align text correctly.

moreover there is some space before text (must be for image), can we decrease width of this extra space as i am not using any images in dropdown.

Thanks
0
Nick
Telerik team
answered on 15 May 2009, 09:15 AM
Hello Sameer Pahuja,

Thank you for contacting us back. You can first try to add some padding. Please note that this will work with limited success. The next thing that you can do is scale the items so that they get smaller. Please take a look at the code snippet below:

void radDropDownButton1_DropDownOpening(object sender, EventArgs e) 
        { 
            int width = this.radDropDownButton1.Size.Width; 
            this.radDropDownButton1.DropDownButtonElement.DropDownMenu.MinimumSize = new Size(width, 0); 
            this.radDropDownButton1.DropDownButtonElement.DropDownMenu.MaximumSize = new Size(width, 1000); 
          
 
            foreach (RadMenuItem item in this.radDropDownButton1.Items) 
            { 
                item.Padding = new Padding(0, 0, 15, 0); 
                item.ScaleTransform = new SizeF(0.95f, 0.95f); 
 
            } 
        } 
 

I hope this helps. Do not hesitate to write me back if you have further questions.

Regards,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Sameer Pahuja
Top achievements
Rank 1
Answers by
Nick
Telerik team
Sameer Pahuja
Top achievements
Rank 1
Share this question
or