AvalonDock 2 with Caliburn Micro
Asked Answered
G

2

7

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>
Gingerly answered 27/1, 2013 at 10:45 Comment(2)
I know this is older now, but I'm back in this same place on a new project. I'm trying to understand this part of the FreePIE codebase, but when I try to copy this approach I get "Cannot find view for System.Windows.Controls.ContentPresenter" instead of the expected view. Is there an obvious reason you might get that instead of the view when using Caliburn?Bombproof
Here was my issue - https://mcmap.net/q/1634997/-avalon-dock-2-0-layoutitemtemplateselector-given-contentpresenter-instead-of-viewmodel. Thanks for posting your eventual solution!Bombproof
S
2

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.

Saccharometer answered 28/1, 2013 at 8:12 Comment(2)
Oh, that's the wrong one then. I updated it though you've probably seen it.Saccharometer
Thanks , you can keep my post too, I have my solution in thereGingerly
B
6

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.

Bombproof answered 3/7, 2013 at 12:9 Comment(1)
Yupp found the same when I was doing this, but for my purpose the framework was way to big. I updated my question with the only part needed to get it to work with CaliburnGingerly
S
2

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.

Saccharometer answered 28/1, 2013 at 8:12 Comment(2)
Oh, that's the wrong one then. I updated it though you've probably seen it.Saccharometer
Thanks , you can keep my post too, I have my solution in thereGingerly

© 2022 - 2024 — McMap. All rights reserved.