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

SplitPanel AutoSize

3 Answers 633 Views
SplitContainer
This is a migrated thread and some comments may be shown as answers.
Mirek
Top achievements
Rank 1
Mirek asked on 07 Jan 2012, 11:03 PM
Hi,
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,
Mirek

3 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Todorov
Telerik team
answered on 11 Jan 2012, 05:56 PM
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.

Regards,
Ivan Todorov
the Telerik team

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

0
Seshu
Top achievements
Rank 1
answered on 25 Feb 2014, 04:26 PM
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
Seshu.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Feb 2014, 01:16 PM
Hello Seshu,

Thank you for contacting us.

You can use the UserControl.Dock property to the parent panel:
public Form1()
{
    InitializeComponent();
 
    UserControl1 uc = new UserControl1();
    uc.Dock = DockStyle.Fill;
    this.radSplitContainer1.SplitPanels[0].Controls.Add(uc);
}

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

Regards,
Desislava
Telerik
Tags
SplitContainer
Asked by
Mirek
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Seshu
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or