Caliburn.Micro Xaml made easy

Caliburn.Micro 3.0.0-alpha

I’m really pleased to announce the release of Caliburn.Micro 3.0.0-alpha, this is a major milestone in that it adds support for three new platforms Xamarin.iOS, Xamarin.Android and Xamarin.Forms. This is an early alpha in order to get feedback and testing from the wider community (which is now a lot bigger thanks to this release).

Xamarin.iOS & Xamarin.Android

In a previous post I broke down Caliburn.Micro in to a box diagram of features.

Caliburn.Micro Overview

I also talked about how a lot of the features don’t make sense for non XAML platform such as Xamarin.iOS and Xamarin.Android. Over the course of the alpha I expect there’ll be discussion about how we can apply some Caliburn-esque features into Xamarin app development.

In 3.0.0-alpha we have the full portable assembly working against Xamarin and as well as the IPlatformProvider and the ViewModelLocator. The goals here are to have the ability to share your view models and their patterns such as event aggregation and view model composition over all the platforms using Portable Class Libraries, while building native apps with their normal patterns such as Activities and View Controllers.

ViewModelLocator is a good example of what I mean by differences with non XAML platforms that ViewModelLocator on Android expects something like MyApp.Activities.LoginActivity and resolves to MyApp.ViewModels.LoginViewModel.

A sample of this sort of app is can be found at Hello.Xamarin in the GitHub repository.

Known Issues

  • The current Storyboard designer for iOS in Visual Studio doesn’t respect the folder / namespace it’s placed in when generating types, as such the current conventions for view model locator MyApp.ViewControllers.LoginViewController to MyApp.ViewModels.LoginViewModel may not make sense in the long term.


This alpha also brings support for Xamarin.Forms which in abstraction layer over the different UIs in iOS, Android and Windows Phone Silverlight (Windows 8 / 10 support coming later). What’s really interesting is that it comes with it’s own XAML syntax (not the same as Windows XAML but very similar), this means we can get a closer to standard Caliburn.Micro experience. I was pleasantly surprised by how much I got ported reasonable easy.

A sample of this sort of app is can be found at Hello.Forms in the GitHub repository.

One of the more interesting features here is that Xamarin.Forms runs on top of the existing mobile platform (Xamarin.iOS, Xamarin.Android and Windows Phone Silverlight). This makes it the first version where two different platforms of Caliburn.Micro have to run side by side. We essentially have two instances of ViewModelLocator, one in Caliburn.Micro.ViewModelLocator for the current host platform and one at Caliburn.Micro.Xamarin.Forms.ViewModelLocator if Xamarin.Forms is present.

Known Issues

  • There is no programmatic access to x:Name in Xamarin.Forms, therefore the feature of name based conventions will not be available, you will need to use normal {Binding Username} and cm:Message.Attach="SignIn".
  • There is no way to check to see if a BindableProperty has a Binding set. Thankfully we only use this ensure name based conventions don’t overwrite existing bindings, given the first issue this is currently less of a problem.
  • I’m not entirly happy with FormsApplication and that both Caliburn.Micro and Xamarin.Forms want to set a custom UIApplicationDelegate, we’ll need a better way of playing together nicely.

Breaking changes

Right now there are no breaking API changes for the existing platforms there are some ABI ones, given the new multi-platform scenario described above I’ve introduced a new assembly Caliburn.Micro.Platform.Core that holds some of the internal classes used the various platform assemblies. This lets us have to platforms at the same time without any type collision.

If you’re using nuget then this new assembly will automatically be referenced, but if you’re doing any sort of manual references you may need to check this out. I’ve applied this change to all the “modern” platforms (.NET 4.5, Windows Phone 8, Windows 8, Windows 8.1 Windows Phone 8.1, Xamarin.iOS and Xamarin.Android). Due to the PCL profile restrictions the .NET 4.0 and Silverlight 5 platforms work as they previously did.

As the alpha progresses I expect there will be breaking changes on the Xamarin platforms, and I don’t expect many if any changes on the others.

How do I get this?

For Xamarin.iOS and Xamarin.Android simply use the normal Nuget package Caliburn.Micro, if you’re wanting to checkout Xamarin.Forms then use the package Caliburn.Micro.Xamarin.Forms.

The code for these releases will most likely stay on the Xamarin branch till it’s closer to being finalised.

What about Windows 10?

At the time of writing this we can’t yet release anything for Windows 10 because there is no framework identifier in Nuget and we only have an alpha of the tools. The Windows 8.1 version works perfectly well in building a Windows 10 app, but I’ve already started working on the Windows 10 version on a separate branch which you can build and use. This adds conventions and binding scope changes for the new controls and creates a single platform for Windows 10 Desktop, Tablets and Phone (and potentially Xbox and HoloLens).

Once the Windows 10 tools are finalised, I would expect to announce something soon after.

The road ahead

There’s a lot of things still to do in this alpha, mostly around the new platforms other than Xamarin.Forms and what features can be brought to them. With new platforms comes new documentation (the website could definitely do with a documentation upgrade) and associated tutorials / blog posts.

I also want to extend both of the sample mentioned above, they’re very bare bones right now.

If you want to follow the process going forward and want to participate checkout the Xamarin - Native & Forms issue on GitHub.

The code for these releases will most likely stay on the Xamarin branch till it’s closer to being finalised.


A massive thank you has to go to Marker Metro here who essentially sponsored all the time it took me to put this 3.0.0-alpha together.

Marker Metro