AvalonDock v2 and Caliburn Micro

AvalonDock v2 and Caliburn Micro

 AvalonDockCaliburnMicro.zip (2.16 mb)

A new version of AvalonDock is due to be released early March. See  http://avalondock.codeplex.com/.
I thought I would attempt to integrate with Caliburn Micro, which should be easier now, as v2 of AvalonDock is MVVM compatible.

To integrate there are two ways that I know of,

(a.) to create a Custom Attached Property or Behaviour as suggested by Felice Pollano, http//www.felicepollano.com/Trackback.aspx?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde

(b.) to create a Custom Convention along the lines that Valeriu Caraulean has done for Telerik controls,
http://blog.caraulean.com/2011/06/05/integration-of-caliburn-micro-and-teleriks-silverlight-controls/

I thought I’d do both. I’ve used the same test program that Valeriu created.

In the attached Zip, I have included both the associated Caliburn.Micro sources and AvalonDock as at 28th Feb, 88810, which is why the Zip might be a bit big. But I hope it means you can compile and test the solution without fishing for other components.

(a.) Works very well. Simple Activate and Deactivate Message Boxes enable you to track how the Conductor OnActive tracks the usage of the tabs.

(b.) Has a bug I can’t find! The Active ViewModel is Deactivated twice when the application closes down.
In certain circumstances, it can cause the app to crash on shutdown. Solution (a.) does not suffer from this.

I hope you find it useful and interesting. Perhaps you can fix the bug!
I’ll attempt to keep this updated as newer versions of AvalonDock are released

Updated 6th March
I’ve updated AvalonDock to 89121.
Also updated the Zip with an improved version of how Tab Closing is handled in the Caliburn Convention version.
Still has the closedown problem however.

Updated 8th March
I’ve changed TestBehaviour to hold a collection of ViewModels instead of Views as in the original.
It’s brought out the Style and Template for the Header to the Tab View to better handle the closing.
I’ve made a small change to Screen.cs to prevent the double Deactivate on shutdown of the app.

John

Comments are closed.