Quantcast
Channel: AvalonDock
Viewing all articles
Browse latest Browse all 2690

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

$
0
0
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?

Viewing all articles
Browse latest Browse all 2690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>