Wednesday, November 26, 2014

Upgrading to Caliburn.Micro 2.0

As Microsoft announced some new WPF features, I found a good excuse to do a WPF blog post Glimlach.

Recently I had to do some changes to an WPF application I built some time ago. While implementing the change, I noticed that a new version of Caliburn.Micro was available. I always loved Caliburn.Micro, it is still one of the best MVVM frameworks out there.

Now doing this upgrade wasn’t that hard but wasn’t a walk in the park either. Here are some of the problems I encountered:

  • Bootstrapper<T> no longer exists. Instead you have to inherit from BootstrapperBase.
  • Inside the Bootstrapper override the OnStartup method and call the DisplayRootViewFor<> method:

protected override void OnStartup(object sender, StartupEventArgs e)

          DisplayRootViewFor<IShell>(); 
}

  • EventAggregator.Publish now takes an action to marshal the event. You can still use the EventAggregator.PublishOnUIThread if you want the original behaviour.
  • Message.Attach should be renamed from clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro to clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platfor

Some other breaking changes can be found here: http://caliburnmicro.com/documentation/migrating-to-2.0.0

No comments: