How do I get Caliburn.Micro working in a visual studio package?

216 views Asked by At

I'm struggling to get the framework to work with a visual studio package I created.

This is my package "exit" point:

[Guid("9151937e-5f9e-48e9-b7ca-6894ff68c292")]
    public class MyToolWindow: ToolWindowPane
    {
        public MyToolWindow() :
            base(null)
        {
            this.Caption = Resources.ToolWindowTitle;
            this.BitmapResourceID = 301;
            this.BitmapIndex = 1;

            //MainView main = new MainView(Some.Container);
            //main.OnError += MainOnOnError;

            // ?????
            base.Content = new ShellView(Some.Container);
        }
    }

This works but this is not starting the bootstrapper. As I understand the bootstrapper will only fire on a WPF application (documentation) but my application consists only of a class library holding the view+viewmodels.

I created an App.xaml file in that assembly:

<ResourceDictionary x:Class="Boulet.Speciaal.App"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Boulet.Speciaal">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary>
            <local:ShellBoot x:Key="bootstrapper" />
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

And this is what my Bootstrapper looks like:

public class ShellBoot: Bootstrapper<ShellViewModel>
    {
        public ShellBoot(IServiceContainer package)
        {
            DisplayRootViewFor<ShellViewModel>();
            Start();
        }
    }

I think the base.Content needs to be set on a View/Usercontrol but I don't know how to fool the framework.

0

There are 0 answers