Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > ComboBox and ListBox (obsolete as of Q2 2010) > Drop down width problem

Answered Drop down width problem

Feed from this thread
  • Posted on May 13, 2009 (permalink)

    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?

    Reply

  • Answer Nick Nick admin's avatar

    Posted on May 13, 2009 (permalink)

    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.

    Reply

  • Posted on May 14, 2009 (permalink)

    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?

    Reply

  • Nick Nick admin's avatar

    Posted on May 14, 2009 (permalink)

    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.

    Reply

  • Posted on May 14, 2009 (permalink)

    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

    Reply

  • Nick Nick admin's avatar

    Posted on May 15, 2009 (permalink)

    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > ComboBox and ListBox (obsolete as of Q2 2010) > Drop down width problem
Related resources for "Drop down width problem"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]