Office 2013 Actions Pane and Caliburn Micro

Topics: Bootstrappers & IoC, Getting Started
Aug 26, 2013 at 11:33 PM
I am trying to use Caliburn Micro as the framework for WPF inside an Excel 2013 Actions Pane, however I am unsure about how this should be done since there is very little documentation on this and I couldn't find much via a web search.

Basically I have referenced the articles on VSTO within Caliburn Micro discussions. So far I have:
1) An Actions Pane added to the Excel document in the ThisWorkbook_Startup method - no problem there.

2) On the design of the Actions Pane, I dropped on a simple ShellView user control
        <Label Content="Hello World!" />
        <TabControl x:Name="Items">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding DisplayName}" />
3) The ShellViewModel.cs has
public class ShellViewModel : Conductor<IScreen>.Collection.OneActive 
        public ShellViewModel()
            ActivateItem(new UploadViewModel());
4) I have a MefBootStrapper, derived from BootstrapperBase passing false to the base constructor. The rest is standard MEF bootstrapper code.

5) In the ActionsPane_Load event, I placed a call
new MefBootstrapper().Start();
I see the Hello World! appearing in the Action Pane but there is nothing in the TabControl. The debugger calls the Configure and GetInstance methods of the MefBootstrapper.

If I remove the ShellView user control from the design surface and change the ShellView.xaml to be a Window instead of a user control, it is no longer listed in the Visual Studio toolbox as a control and I can't drop it onto the design surface. Adding the following code in the Actions Pane load event does not cause the ShellView to show up.
            var windowManager = IoC.Get<IWindowManager>();
            windowManager.ShowWindow(new ShellViewModel());
All code is in a single solution. Has anyone tried this who can point me in the right direction.
Sep 2, 2013 at 9:46 PM
I finally got something to work by doing the following.

1) Keep the new MefBootstrapper().Start() in the ActionsPane Load event - without the call to the Start method none of the bootstrapper methods are called.
2) You don't need the the windowManager stuff and it doesn't work unless you use ShowPopup.
3) Drop an instance of your root visual (in my case ShellView) onto the designer in Visual Studio and it will automatically get wrapped in an ElementHost
4) If you run the code now, you will notice that the ShellView and ShellViewModel do not get hooked together - the only way I could get it to work was to add a cal:Bind:Model line to the ShellView.xaml file.

This now works and all the other Caliburn Micro features like event aggregation work normally.
I hope this helps anyone else stuck on this problem and if there is another way to hook the ShellView and ShellViewModel together with the non-generic bootstrapper then I would love to know.