How to add RadDocumentPane in code

2 posts, 0 answers
  1. Klinger
    Klinger avatar
    3 posts
    Member since:
    Jun 2009

    Posted 03 Jun 2009 Link to this post

    I have the following Silverlight xaml:

    <radDock:RadDocking >
          <radDock:RadPaneGroup x:Name="ContentRegion" >

    My question is:
    How do I add a RadDocumentPane object to the ContentRegion (a RadPaneGroup) object in C# code?

    I tried ContentRegion.AddItem(..) but I got an exception. Collection is readonly.

    Which method should I use to add new content to the group?

    Any help is appreciated.


  2. Kaloyan
    Kaloyan avatar
    920 posts

    Posted 04 Jun 2009 Link to this post

    Hello Klinger,

    The logical parent of the RadPaneGroup always should be RadSplitContainer. The error you are getting is due to the fact that the parent of the RadPaneGroup has not been initialized. To make this work as expected pleadse use the code snippet shown below:  

    <Docking:RadDocking x:Name="dock" Grid.Row="3" Grid.RowSpan="3" Grid.Column="0"
                        <Docking:RadPaneGroup x:Name="ContentRegion" /> 
    using System.Windows; 
    using System.Windows.Controls; 
    using Telerik.Windows.Controls; 
    using Telerik.Windows.Controls.Docking; 
    namespace SupportSL 
        public partial class Page : UserControl 
            public Page() 
                dock.Loaded += new RoutedEventHandler(dock_Loaded); 
            void dock_Loaded(object sender, RoutedEventArgs e) 
                ContentRegion.AddItem(new RadPane() { Title = "test" }, DockPosition.Left); 

    Hope this helps.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
Back to Top