How can I add DocumentContent by code as a plugin?

Jun 24, 2009 at 11:57 PM
Edited Jun 25, 2009 at 12:28 AM

Hello,

I have the following code:

 

                  <ad:DocumentPane x:Name="pluginHost">
                        <ad:DocumentContent Title="Plugin 1">
                            <RichTextBox/>
                        </ad:DocumentContent >
                        <ad:DocumentContent Title="Plugin 2">
                            <RichTextBox/>
                        </ad:DocumentContent >
                    </ad:DocumentPane>

 

Now I want to add another DocumentContent by code but I did not find a Method like pluginHost.AddChild(dc) and with pluginHost.Items.Add(dc) I get an InvalidOperationException.

May it be a problem with the parent user control?

<UserControl x:Class="TestModule.TestModuleUC"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock" 
    Height="300" Width="300">
    <ad:DockableContent Name="TestModuleDC" Title="Test Modul">
        <StackPanel>
            <Label Content="Test Module"/>
            <RichTextBox/>
        </StackPanel>
    </ad:DockableContent >
</UserControl>

Because I say

UserControl uc = new TestModuleUC;

DocableContent dc =uc.TestModuleDC;

Any idea?

Thanks in advance