[Version 2.0] Most simple binding issue ever?

May 10, 2012 at 2:07 AM

It's probably me being stupid, but what am I missing here, in my most simple binding scenario:

<AvalonDock:DockingManager Grid.Row="1"
                                   x:Name="dockLayout"
                                   DocumentsSource="{Binding Tools}"
                                   AnchorablesSource="{Binding Tools}"
                                   ActiveContent="{Binding SelectedDocument}">
            
            <AvalonDock:DockingManager.DocumentTemplate>
                <DataTemplate DataType="{x:Type ViewModels:ViewModel}">
                    <Button>Test</Button>
                </DataTemplate>
            </AvalonDock:DockingManager.DocumentTemplate>
            
            <AvalonDock:DockingManager.AnchorableTemplate>
                <DataTemplate DataType="{x:Type ViewModels:ViewModel}">
                    <Button>Test</Button>
                </DataTemplate>
            </AvalonDock:DockingManager.AnchorableTemplate>
            
            

            <avalonDock:LayoutRoot>
                <avalonDock:LayoutPanel>
                    <avalonDock:LayoutAnchorablePane/>
                    <avalonDock:LayoutDocumentPane />                    
                </avalonDock:LayoutPanel>
            </avalonDock:LayoutRoot>
        </AvalonDock:DockingManager>

 

The binding to the DocumentsSource-property works, the binding to the AnchorablesSource doesn't. Why? More precisely, the binding does work (the AnchorablesSource has elements) but they are not displayed.

Can you help me with that?

I'm new to AD and looking forward to using it and building nice stuff.

 

Regards from NZ,

Marc

May 12, 2012 at 5:57 AM

Nobody any comments or advice?

May 12, 2012 at 9:05 AM

Hi, latest version has the LayoutItemTemplate instead of two separates template for Anchorables and Documents. Please download it and test your project with the new version. Also please take a look at the MVVMTestApp sample project that should give you a general overview of how to getting started with AD in a MVVM environment.
BTW, Why you are binding Anchorables and Documents to the same source? usually one should have two separate list as documents are really different from what is usually called 'tools'

May 13, 2012 at 12:14 AM

Thank you very much, I was working on the wrong version. It all works well. I bound to the same collection only for testing purposes, no worries, I got the concept :) Thank you really much for your effort, the new version is released at a perfect time for my project!

Jun 12, 2012 at 4:48 PM

What if I want to have one tools panel on the left side and one on the right side? How would you bind that?? Thanks

Feb 3, 2013 at 1:09 PM
Please, can you tell me, how to have templates only for documents? I have LayoutAnchorablePane on left and right side and in the midle is LayoutDocumentPane. I need to create LayoutItemTemplate only for Documents.

At the beginning of DockingManager there is
<ad:DockingManager.LayoutItemTemplate>
    <DataTemplate> 
        <ContentControl cal:View.Model="{Binding}" IsTabStop="False"/> 
    </DataTemplate>
</ad:DockingManager.LayoutItemTemplate>
...
but then there is a trouble "Cannot find view for ..." - it's shown on left and right side panels, which are not Views