Caliburn.Micro Xaml made easy

Caliburn.Micro 3.0.0-beta1

I’m really pleased to announce the release of Caliburn.Micro 3.0.0-beta1, this is a major milestone in that it adds support for a new platform Universal Windows Platform / Windows 10 as well as for the three new platforms Xamarin.iOS, Xamarin.Android and Xamarin.Forms added in 3.0.0-alpha.

This is an early beta in order to get feedback and testing from the wider community (which is now a lot bigger thanks to this release).

All the release notes from 3.0.0-alpha apply to this release as well.

Windows 10

The Windows 10 release follows along with the Windows 8.1 and Windows Phone 8.1 releases and combines them into a single library which is great from a maitenance perspective. If we need to start adding features specific to Phone, Xbox or even HoloLens they’ll be done using feature detection via Windows.Foundation.Metadata.ApiInformation.

Also included is a sample showing how to set up a SplitView style app with the Frame not being the root visual but inside the ShellView, this sample is available at Hello UWP.

Preserving state

One new feature in this release is the CachingFrameAdapter. This subclass of FrameAdapter (which implements INavigationService in WinRT platforms such as Windows 8.1, Windows Phone 8.1 and Windows 10) will cache internally view models and reuse them on the appropriate navigation. This allows scenarios where the built in NavigationCacheMode doesn’t make sense but still preserve your view model state. A sample of this in action is available at Caliburn.Micro.State.

Xamarin Forms

  • Included NavigationHelper which adds the For<TViewModel> method to allow easier view model navigation.
navigationService.For<ProductViewModel>()
    .WithParam(v => v.ProductId, 42)
    .Navigate();

Other Changes

  • Resolved a WPF bug using MainWindow when it’s disposed. Thanks dvdorle.
  • Resolved ViewLocator.LocateForModelType failing to deal with improperly reused views in WinRT.
  • Resolved a premature garbage collection issue in Action.Invoke.
  • Removed a unnecessary explicate collection in FrameAdapter.
  • BindingScope has been cleaned up a lot so will be easier to extend.

Breaking Changes

All the breaking changes from 3.0.0-alpha apply to this release as well.

  • The extensions projects have moved into the main platform assembly, these were initially created as a place for very platform specific code but they’ve outlived there usefulness and removing them reduces some maintenance costs.
  • Bind.Model had a feature enabling you to pass a string which used IoC to find the model. This was deprecated in 2.0.0 and has now been removed.
  • SimpleContainer now only uses public constructors. Thanks belyansky.
  • The UriFor method has been deprecated in favour of just For given the lack of uri support on a number of platforms.
  • WinRT platforms now make use of AssemblySourceCache which means if your view models do not implement INotifyPropertyChanged or views subclass from UIElement then they may not be found by ViewLocator or ViewModelLocator. This behaviour can be changed by modifying AssemblySourceCache.ExtractTypes.

How do I get this?

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

Previously the code for all these new features was spread across a number of branches, it’s now consolidated in a single 3.0.0 branch.

Where to from here?

  • More Xamarin testing.
  • Expand on the platform specific samples.
  • Expand on the platform specific documentation.