Windows 8 – Using Caliburn.Micro

By Dries Marckmann
January 10, 2013
0

A collegue of mine followed this blogpost (http://www.jfarrell.net/2012/11/caliburn-from-windows-8-apps.html) to implement Caliburn.Micro in the WinRT app…

He stumbled upon a problem. The post seems to suggest that you should remove all content from your App.xaml, but then the reference to the resource common/standardstyles.xaml will be missing and the default item templates for pages are going to give you errors.

I followed this blogpost (http://mikaelkoskinen.net/caliburn-micro-for-winrt-getting-started) which prevented that issue… However, I still had a problem with getting a new Basic Page to use my ViewModel.

The problem was the line marked in yellow below:

<common:LayoutAwarePage

x:Name=”pageRoot”

x:Class=”InThePocket.BasicPage1″

DataContext=”{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}”

xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”

xmlns:local=”using:InThePocket”

xmlns:common=”using:InThePocket.Common”

xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″

xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″

mc:Ignorable=”d”>


<common:LayoutAwarePage>


This line binds the page to a DefaultViewModel and thus overrides the binding that Caliburn.Micro creates.


Hope it will help you avoid or solve these problems…

Comments: 0

Leave a Reply

Your email address will not be published. Required fields are marked *