2

Closed

xmlns:cal="http://www.caliburnproject.org" is not working in WP7/8

description

I'm setting up a Windows Phone 8 project and I've noticed that I can't use the short syntax to attach an action to a control, like for example:

<Button cal:Message.Attach="[EventName Click] = [Action ShowNameAction]" Content="Click" />

The cal namespace is defined like this:

xmlns:cal="http://www.caliburnproject.org"

When I launch the application, I get a XamlParseException complaining that no Attach property has been found for Message.

If I use the long syntax, instead, everything is working fine.
Closed Mar 10, 2013 at 2:01 AM by EisenbergEffect
Fixed.

comments

tibel wrote Jan 19, 2013 at 8:08 PM

You can use xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" then the short syntax for cal:Message.Attach will work.

Seems that there is an issue with http namespace declarations in WP8.

qmatteoq wrote Jan 19, 2013 at 10:13 PM

Thanks for the feedback!
With your suggestion the exception is gone, but still doesn't work. I click on the button and nothing happen. The strange thing is that CanExecute method is evaluated successfully instead.
So, in the end, here is my code in XAML:

<Button cal:Message.Attach="[EventName Click] = [Action ShowName]" Content="Clicked" />

and this is my view model:
    public bool CanShowName
    {
        get { return IsEnabled; }
    }

    public void ShowName()
    {
        MessageBox.Show("Clicked");
    }
The CanShowName property is correctly evaluated, but when I click on the button the ShowName method is not invoked.

tibel wrote Jan 20, 2013 at 7:49 AM

When you change your button definition to use Event instead of EventName it will work:
<Button cal:Message.Attach="[Event Click] = [Action ShowName]" Content="Clicked" />

The other issue is with the http namespace:
Adding <AssemblyPart x:Name="Caliburn.Micro" Source="Caliburn.Micro.dll" /> to AppManifest.xml will prevent the exception on runtime. The XAML designer in VS2012 is still not able to display a preview and It occurs on WP71 projects too.

Is XmlnsDefinitionAttribute not supported on Windows Phone any more???

tibel wrote Jan 23, 2013 at 6:39 PM

I removed "http://www.caliburnproject.org" from WP7 and WP8 version of Caliburn.Micro.

EisenbergEffect wrote Feb 28, 2013 at 7:57 PM

** Closed by EisenbergEffect 02/28/2013 12:57PM