Setting RadGroupBox AutoSizeMode

8 posts, 0 answers
  1. Jonathan Zee
    Jonathan Zee avatar
    22 posts
    Member since:
    Mar 2009

    Posted 26 May 2009 Link to this post

    Hi guys,

    I'm in the process of converting all existing WinForm GroupBoxes to RadGroupBoxes programatically. However there's a property called AutoSizeMode that's missing and I need some help to resize a groupbox based on the number of controls in it.

    The code that I'm working with now is
    1 GroupBox dbGroupBox = new GroupBox();             
    2 dbGroupBox.Location = new System.Drawing.Point(10, 0); 
    3 dbGroupBox.Name = databaseInstance + pageName; 
    4 dbGroupBox.TabIndex = 0; 
    5 dbGroupBox.TabStop = false
    6 dbGroupBox.Text = pageTitle + "  (Possible Matchs)"
    7 dbGroupBox.AutoSize = true;         
    8 dbGroupBox.AutoSizeMode = AutoSizeMode.GrowOnly;                         
    9 dbGroupBox.Tag = tag.ToString(); 
    10 dbGroupBox.BackColor = Color.Transparent; 

    and I need to convert it into

    1 RadGroupBox dbGroupBox = new RadGroupBox(); 
    2 dbGroupBox.Location = new System.Drawing.Point(460, groupBoxY); 
    3 dbGroupBox.Name = databaseInstance + pageName; 
    4 dbGroupBox.TabIndex = 0; 
    5 dbGroupBox.TabStop = false
    6 dbGroupBox.Text = pageTitle + "  (Possible Matchs)"
    7 dbGroupBox.AutoSize = true;         
    8 //dbGroupBox.AutoSizeMode = AutoSizeMode.GrowOnly;                         
    9 dbGroupBox.Tag = tag.ToString(); 
    10 dbGroupBox.BackColor = Color.Transparent; 

    Note that line 8 has been commented out because there's no AutoSizeMode in a RadGroupBox. Can you advise on how I can toggle a resize on the Groupbox based on the number of controls within the box? (i.e. the controls are generated dynamically.)

    Thanks

  2. Nick
    Admin
    Nick avatar
    767 posts

    Posted 27 May 2009 Link to this post

    Hi Jonathan Zee,

    Thank you for your question. Unfortunately, while AutoSize property is present, there is a bug and hence our RadGroupBox controls behaves differently than the standard GroupBox. For the time being, I can only suggest the work-around of setting RadGroupBox size manually when you add controls to its Controls collection. You need to take into consideration the location and the size of your dynamically added controls and expand the control accordingly. Please excuse us for the introduced inconvenience.

    Best wishes,
    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. David
    David avatar
    9 posts
    Member since:
    Sep 2010

    Posted 29 Sep 2010 Link to this post

    Is this still broken?  When is it going to be fixed?  I'm having the exact same problem, and would love to know of a workaround if there is one.  
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 04 Oct 2010 Link to this post

    Hello David,

    Thank you very much for raising this question again.

    Currently, I cannot provide you with a specific time frame when this case will be covered. There are features and fixes with higher priority due to their higher popularity within our community. This is why this issue is not yet scheduled fox fixing

    However, you can work around this behavior by following the suggestion of my colleague Nick.

    Should you have any other questions, do not hesitate to contact me.

    Kind regards,
    Stefan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. David A.
    David A. avatar
    126 posts
    Member since:
    Aug 2008

    Posted 07 Apr 2011 Link to this post

    Hello.

    I am experiencing the same grief with this.  I have a tablelayoutpanel inside a RadGroupBox and setting RadGroupBox.AutoSize doesn't do anything.  I have to manually set the height for each instance this occurs.  A fix would be very nice.  Thank you.
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 12 Apr 2011 Link to this post

    Hi David ,

    Thank you for writing.

    Please find this issue PITS item at this link. You can subscribe for its status updates and also you can add your vote for it.

    Best wishes,
    Stefan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Adam P
    Adam P avatar
    27 posts
    Member since:
    Jan 2014

    Posted 24 Apr 2014 Link to this post

    Hi, is this still an issue?  I can't find an AutoSIzeMode property
  9. Dess
    Admin
    Dess avatar
    1607 posts

    Posted 24 Apr 2014 Link to this post

    Hello Adam,

    Thank you for writing.

    We have introduced a fix for the referred issue in Q1 2013 (version 2013.1.220). For reference, here is the Feedback Item. I would like to note that the issue is related to the RadGroupBox.AutoSize property, not to the AutoSizeMode property, which is relevant for the GroupBoxElement. Here is a sample code snippet:
    public Form1()
    {
        InitializeComponent();
     
        this.radGroupBox1.AutoSize = true;
        for (int i = 0; i < 10; i++)
        {
            RadButton btn = new RadButton();
            btn.Text = "Button" + i;
            btn.Location = new Point(radGroupBox1.Location.X, radGroupBox1.Location.Y + i * 25 + 5);
            this.radGroupBox1.Controls.Add(btn);
        }
    }

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready