[Version 2.0] Avalon dock within a TabItem does not load

Jan 20, 2014 at 3:18 PM
I have a requirement to load the avalondock [1] control inside each tab of a tabcontrol.

[1] - http://avalondock.codeplex.com/wikipage?title=AvalonDock%202.0%20Getting%20Start%20Guide

Before complicating this, I have written a simple poc app to just load tabItems from my viewmodel & load the dock control in each tab, xaml below...
<TabControl ItemsSource="{Binding TabItems}">
    <TabControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Header}" />
        </DataTemplate>
    </TabControl.ItemTemplate>
    <TabControl.ContentTemplate>
        <DataTemplate>
            <!--<TextBlock Text="{Binding Content}" />-->
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <TextBlock Grid.Row="0" Text="{Binding Content}"></TextBlock>
                <xcad:DockingManager Grid.Row="1" x:Name="dockingManager" VerticalAlignment="Top" Background="Red"  Width="500" Height="500" >
                    <xcad:LayoutRoot>
                        <xcad:LayoutPanel Orientation="Horizontal">
                            <xcad:LayoutDocumentPane>
                                <xcad:LayoutDocument Title="Document 1">
                                    <TextBlock x:Name="dockTextBlock" Background="Green" VerticalAlignment="Top" Text="Hello World"></TextBlock>
                                </xcad:LayoutDocument>
                            </xcad:LayoutDocumentPane>
                        </xcad:LayoutPanel>
                    </xcad:LayoutRoot>
                </xcad:DockingManager>
            </Grid>
        </DataTemplate>
    </TabControl.ContentTemplate>
</TabControl>
My View Model is passing the following...
TabItems = new ObservableCollection<TabItem>()
{
    new TabItem(){Header  = "Tab 1", Content = "I am tab 1"},
    new TabItem(){Header = "Tab 2", Content = "I am tab 2"}
};

private ObservableCollection<TabItem> _tabItems;

public ObservableCollection<TabItem> TabItems
{
    get { return _tabItems; }
    set
    {
        _tabItems = value;
        RaisePropertyChanged(() => TabItems);
    }

}
The tab items are loading correctly and I can see the Content, but the dockcontrol does not load, I was expecting to see the dockcontrol with a Hello World text box in each tab. Clearly I am missing something.

Has someone run into this? Is it a data context problem? Any thoughts?
Jan 20, 2014 at 3:52 PM
Edited Jan 20, 2014 at 3:56 PM
I can't see where you add documents and anchorables to your docking Manager.