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

How to add RadDocumentPane in code

1 Answer 109 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Klinger
Top achievements
Rank 1
Klinger asked on 03 Jun 2009, 09:02 AM

I have the following Silverlight xaml:

<radDock:RadDocking >
   <radDock:RadDocking.DocumentHost>
      <radDock:RadPaneGroup x:Name="ContentRegion" >
      </radDock:RadPaneGroup>
   </radDock:RadDocking.DocumentHost>
</radDock:RadDocking>

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.

 

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 04 Jun 2009, 01:52 PM
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:RadDocking.DocumentHost> 
                <Docking:RadSplitContainer> 
                    <Docking:RadPaneGroup x:Name="ContentRegion" /> 
                </Docking:RadSplitContainer> 
            </Docking:RadDocking.DocumentHost> 
        </Docking:RadDocking> 
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() 
        { 
            InitializeComponent(); 
 
            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,
Kaloyan
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Tags
Docking
Asked by
Klinger
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or