Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AvalonDock 2 with Caliburn Micro

Are there any blogs or articles about using AvalonDock with Caliburn Micro MVVM? Didn't find much when Googling

http://avalondock.codeplex.com/

edit: Got an up vote so why not update with a final solution. Full code can be found here

https://github.com/AndersMalmgren/FreePIE

Most of the avalon related code is found here

https://github.com/AndersMalmgren/FreePIE/blob/master/FreePIE.GUI/Shells/MainShellView.xaml

Update after Sam's answer

Its very, very little that needs to be done to enable Caliburn. First implement a LayoutItemTemplateSelector

public class AutobinderTemplateSelector : DataTemplateSelector
{
    public DataTemplate Template { get; set; }

    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        return Template;
    }
}

And use it together with the content control and Caliburns View.Model attach mechanism like

<xcad:DockingManager.LayoutItemTemplateSelector>
    <avalonDock1:AutobinderTemplateSelector>
        <avalonDock1:AutobinderTemplateSelector.Template>
            <DataTemplate>
                <ContentControl cal:View.Model="{Binding . }" IsTabStop="False" />
            </DataTemplate>
        </avalonDock1:AutobinderTemplateSelector.Template>
    </avalonDock1:AutobinderTemplateSelector>
</xcad:DockingManager.LayoutItemTemplateSelector>
like image 289
Anders Avatar asked Jan 27 '13 10:01

Anders


2 Answers

While researching this same thing I came across the Gemini framework being developed by Tim Jones:

Github - https://github.com/tgjones/gemini

Website - http://documentup.com/tgjones/gemini

It's an attempt to integrate AvalonDock with Caliburn.Micro to provide a single framework for building IDE-like applications. It's still in the early stages, but he's implementing some interesting abstractions that build upon Caliburn's overall design.

It also has some good demo applications that show how the framework could be used.

like image 54
Sam Storie Avatar answered Dec 08 '22 05:12

Sam Storie


http://caliburnmicro.codeplex.com/discussions/231809 and http://caliburnmicro.codeplex.com/discussions/430994 (solution)

I believe that is the post I used to create a similar doc manager for telerik's RadDockingManager. That post and this code might help.

like image 23
Derek Beattie Avatar answered Dec 08 '22 05:12

Derek Beattie