[Version 2.0] LayoutDocument ViewModel

Jul 17, 2012 at 11:11 PM
Edited Jul 17, 2012 at 11:12 PM

Ok i am pretty new in WPF and AvalonDock even more, but i think i can grasp main concept of them. However i have been struggling on how add to starting layout, LayoutDocument which could be connected  then to it's ViewModel.

If i understand it right, default layout can be declaratively created in XAML like this:

            <avalonDock:LayoutRoot>
                <avalonDock:LayoutPanel Orientation="Vertical">
                    <avalonDock:LayoutDocumentPane >
                        <avalonDock:LayoutDocument Title="Tab1">
                            <local:TextControl />
                        </avalonDock:LayoutDocument>
                        <avalonDock:LayoutDocument Title="Tab2">
                            <local:TextControl />
                        </avalonDock:LayoutDocument>
                    </avalonDock:LayoutDocumentPane>
                    <avalonDock:LayoutAnchorablePane Name="ToolsPane" DockHeight="150">
                    </avalonDock:LayoutAnchorablePane>
                </avalonDock:LayoutPanel>
            </avalonDock:LayoutRoot>


But i came up that this can not be right, since (at least in sample application provided with sources) when new Document is created, a new ViewModel is added to observable collection bound to DocumentsSource of DockingManger, and its View is created thanks to data template selector. And here i add to Layout some views and don't have a way to connect them with its view models and add them to docking manager collection. I understand that something can be done for LayoutAnchorablePane thanks to ILayoutUpdateStrategy interface, but what about LayoutDocument? And why any of Document element doesn't have Name property?