Drop down width problem

6 posts, 1 answers
  1. Sameer Pahuja
    Sameer Pahuja avatar
    6 posts
    Member since:
    Feb 2008

    Posted 13 May 2009 Link to this post

    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?

  2. Answer
    Nick
    Admin
    Nick avatar
    767 posts

    Posted 13 May 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Sameer Pahuja
    Sameer Pahuja avatar
    6 posts
    Member since:
    Feb 2008

    Posted 14 May 2009 Link to this post

    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?
  5. Nick
    Admin
    Nick avatar
    767 posts

    Posted 14 May 2009 Link to this post

    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.
  6. Sameer Pahuja
    Sameer Pahuja avatar
    6 posts
    Member since:
    Feb 2008

    Posted 14 May 2009 Link to this post

    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
  7. Nick
    Admin
    Nick avatar
    767 posts

    Posted 15 May 2009 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready