Use Caliburn in mixed Avalon Situation

May 16, 2012 at 8:37 AM

Hello.

I'm new in AvalonDock and Caliburn Micro.

I want to use the Calibrun Micro to bind only several Views in my project and get / show as Avalon Dock DocumentContent.

Some example Code :

View XAML

<ad:DocumentContent x:Class="TestComponent.CaliburnTest"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" 
             xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Button Name="Button1" Content="Action" Height="23" HorizontalAlignment="Left" Margin="12,12,0,0" VerticalAlignment="Top" Width="75" />
    </Grid>
</ad:DocumentContent>

ViewModel

using System.Windows;
using Caliburn.Micro;

namespace TestComponent
{
  class CalibrunTestViewModel : PropertyChangedBase
  {
    public void Button1()
    {
      MessageBox.Show("Hello Caliburn !");
    }
  }
}

How i can bind the view and viewmodel and show it as DocumentContent of avalon dock ?

I guees i need to do it with the ViewModelBinder but i have no idea how i could get my DocumentContent View from IoC.

Many thanks in advance for any advice.

Regards

Marcus

 

 

 

May 17, 2012 at 6:15 PM

Hello,
I assume you mean new version 2 of AvalonDock?
John

May 21, 2012 at 6:53 AM

Hello John,

i'm using Version 1.3.1, should i change to Version 2 ? I get it from NuGet.

 

Regards

Marcus

May 21, 2012 at 7:56 AM

I think that's up to you, and whether your work is new.
See, http://avalondock.codeplex.com/

I've never used 1.3, but I believe that version is difficult to use with MVVM, hence articles like
http://www.codeproject.com/Articles/239342/AvalonDock-and-MVVM

Good luck

May 21, 2012 at 8:28 AM

Thanks for pointing to useful articel, a lot of stuff ;)

I had still the hope that i can use caliburn in serveral document views of avalon dock without having a lot of stuff around.

Additional issue is the views are in separat DLL / Library Assemblys and Caliburn are not configured / bootstraped in the application.

Thats are insurmountable challenges for me and my knowing at the moment.

Regards