AvlonDock 2.0 and Caliburn Micro

Topics: Conventions, Extensibility
Jan 27, 2013 at 10:55 AM

Hi.

I'm trying to use AvalonDock 2.0 with Caliburn, the first problem I encounter is how to use the Autobinder to setup a ViewModel against a View, this does not work

<avalondock:LayoutDocumentPane>
    <avalondock:LayoutAnchorable Title="My View">
        <ContentControl x:Name="MyViewModel" />
    </avalondock:LayoutAnchorable>
</avalondock:LayoutDocumentPane>

I'm guessing Caliburn cant intercept the content control inside the avalon control?

Jan 27, 2013 at 7:10 PM
Edited Jan 27, 2013 at 7:10 PM

there a few examples of using a docking system just do a search, it wasn't specific to avalon

 

Jan 27, 2013 at 10:11 PM
Edited Jan 27, 2013 at 10:15 PM

I got that part working based on the MVVM example. Looks like this now

        <avalonDock:DockingManager
            AnchorablesSource="{Binding Tools}"
            DocumentsSource="{Binding Scripts}"
            ActiveContent="{Binding ActiveScript, Mode=TwoWay}">
            <avalonDock:DockingManager.LayoutItemContainerStyle>
                <Style TargetType="{x:Type avalondock:LayoutItem}">
                    <Setter Property="Title"
                Value="{Binding Model.Title}" />
                </Style>
                
            </avalonDock:DockingManager.LayoutItemContainerStyle>
            <avalonDock:DockingManager.LayoutItemTemplateSelector>
                <avalon:AutobinderTemplateSelector>
                    <avalon:AutobinderTemplateSelector.Template>
                        <DataTemplate>
                            <ContentControl cal:View.Model="{Binding . }" IsTabStop="False" />
                        </DataTemplate>
                    </avalon:AutobinderTemplateSelector.Template>
                </avalon:AutobinderTemplateSelector>
            </avalonDock:DockingManager.LayoutItemTemplateSelector>
            <avalondock:LayoutRoot>
                <avalondock:LayoutPanel Orientation="Vertical">
                    <avalondock:LayoutDocumentPane/>
                    <avalondock:LayoutAnchorablePane DockHeight="150">
                    </avalondock:LayoutAnchorablePane>
                </avalondock:LayoutPanel>
            </avalondock:LayoutRoot>
        </avalonDock:DockingManager>

Important part is

<ContentControl cal:View.Model="{Binding . }" IsTabStop="False" />

Each model needs to Inherit from a Base thats have a Title property

Jan 28, 2013 at 7:49 AM

Also you might have a look at Gemini from Tim Jones.

Jan 28, 2013 at 7:59 AM
Edited Jan 28, 2013 at 8:00 AM

Thanks saw that one, but it was a bit hefty for me, it takes a way the Micro form Caliburn. But the above stuff works nice.