SplitPanel AutoSize

4 posts, 1 answers
  1. Mirek
    Mirek avatar
    2 posts
    Member since:
    Dec 2011

    Posted 07 Jan 2012 Link to this post

    I am using version Q3 2011.

    1. I have a RadPageViewPage object in which I placed a RadSplitContainer (DockStyle.Fill) with two SplitPanels.
    2. Each SplitPanel has Padding property set.
    3. In the first SplitPanel I add a control and set its Dock property to Fill the entire content of the panel.
    4. In the second SplitPanel instance I add number of controls with their Dock properties set to Top, but the entire SplitPanel's default size is way bigger than the sum of the controls embedded within.
    5. I am not using designer, the controls are added programmatically.

    Question is: How do I AutoSize both SplitPanel so that the second fits the size of child controls (with set Dock properties to DockStyle.Top) and the first one fill all space that is left?

    Best regards,
  2. Answer
    Ivan Todorov
    Ivan Todorov avatar
    688 posts

    Posted 11 Jan 2012 Link to this post

    Hi Mirek,

    Thank you for your question.

    The AutoSize property comes from the base Control class, but is not relevant for all controls. RadSplitContainer is one of the controls that does not support AutoSize. Furthermore, when you set the Dock property of RadSplitContainer to Fill, it always occupies the entire client area of its parent (the RadPageViewPage) and therefore cannot be sized. On the other hand, the SplitPanels are arranged internally by the RadSplitContainer and also cannot be sized.

    To achieve the desired scenario, you can implement the automatic sizing by handling some events. This is demonstrated in the attached files.

    I hope this will help you. Do not hesitate to ask if you have any additional questions.

    Ivan Todorov
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

  3. DevCraft R3 2016 release webinar banner
  4. Seshu
    Seshu avatar
    3 posts
    Member since:
    Nov 2012

    Posted 25 Feb 2014 in reply to Ivan Todorov Link to this post

    I have Split container with split panels. I have a user control with a tree control in it.
    I would like dock it to left panel (same size of the panel). How can I dock it to parent panel?
    I am using leftTopPanel.Controls.Add(new test()); to add control. And test() is my user control.

    How can I dock this control to parent panel?

    Thanks for the help
  5. Dess
    Dess avatar
    1562 posts

    Posted 28 Feb 2014 Link to this post

    Hello Seshu,

    Thank you for contacting us.

    You can use the UserControl.Dock property to the parent panel:
    public Form1()
        UserControl1 uc = new UserControl1();
        uc.Dock = DockStyle.Fill;

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

Back to Top