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

Create docking programmatically

4 Answers 71 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Li
Top achievements
Rank 1
Li asked on 20 Jun 2012, 03:40 PM
Hi,

Is that possible to create the whole docking layout in the following example programmatically.
It means there should be nothing in xaml file.

http://demos.telerik.com/silverlight/#Docking/SplitContainers

4 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 21 Jun 2012, 08:54 AM
Hello Li,

There shouldn't be any problems when creating RadDocking from the code behind, here are a few articles where you can find the XAML, C# and VB codes for creating splitcontainers, panegroups, etc..and setting their properties:


Hope this helps.

All the best,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Li
Top achievements
Rank 1
answered on 21 Jun 2012, 09:33 AM
Hello Vladi,

Following is the xaml file and code behind file:

<Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadDocking Name="docking">
            <telerik:RadSplitContainer x:Name="splitContainer2" InitialPosition="DockedBottom">
            </telerik:RadSplitContainer>
        </telerik:RadDocking>
</Grid>

public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            RadPaneGroup newRadPaneGroup2 = new RadPaneGroup();
            newRadPaneGroup2.TabStripPlacement = Dock.Top;

            newRadPaneGroup2.Items.Add(new RadPane() { Header = "Bottom1" });
            newRadPaneGroup2.Items.Add(new RadPane() { Header = "Bottom2" });

            this.splitContainer2.ItemsSource = new List<RadPaneGroup> { newRadPaneGroup2 };
        }
    }

Problem is when i try to dock or auto hide the pane, i get NullReferenceException.
Docking Version is 2011.3.1116.1040

Best wishes
0
Li
Top achievements
Rank 1
answered on 21 Jun 2012, 11:11 AM
Hello Vladi,

Thank you for your answer.

I should use Items.Add instead of setting ItemsSource.

Best wishes

Li
0
Vladi
Telerik team
answered on 21 Jun 2012, 11:19 AM
Hi Li,

Yes that is the correct way of adding Items to SplitContainers.

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Docking
Asked by
Li
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Li
Top achievements
Rank 1
Share this question
or