Create docking programmatically

5 posts, 1 answers
  1. Li
    Li avatar
    46 posts
    Member since:
    Feb 2011

    Posted 20 Jun 2012 Link to this post

    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
  2. Answer
    Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 21 Jun 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Li
    Li avatar
    46 posts
    Member since:
    Feb 2011

    Posted 21 Jun 2012 Link to this post

    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
  5. Li
    Li avatar
    46 posts
    Member since:
    Feb 2011

    Posted 21 Jun 2012 Link to this post

    Hello Vladi,

    Thank you for your answer.

    I should use Items.Add instead of setting ItemsSource.

    Best wishes

    Li
  6. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 21 Jun 2012 Link to this post

    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 >>

Back to Top
DevCraft banner