ActionMessage Not in Namespace

Topics: Actions & Coroutines, Bugs
Jan 22 at 4:08 PM
Edited Jan 22 at 4:11 PM
I am using VS2013 to create a WPF 45 project. Everything works fine except for the ActionMessage. I have tried setting up the namespace two ways:
  1. xmlns:cal="http://www.caliburnproject.org"
  2. xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
Then, setting up a button to use an Action using either of 2 methods:

Method 1:
        <Button Content="{Binding ConfirmButtonText}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <cal:ActionMessage MethodName="ConfirmCommand"></cal:ActionMessage>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
Method 2:
        <Button Content="{Binding ConfirmButtonText}" 
                cal:Message.Attach="[Event Click] = [Action ConfirmCommand()]" />
In all cases, the code runs as designed. However the page will not display properly in Blend or the VS designer because of an "Invalid Markup" error:
  • The name "Message" does not exist in the namespace (whichever is referenced by cal:).
  • The name "ActionMessage" does not exist in the namespace (whichever is referenced by cal:)
I want to use this product, but this is a showstopper. If the forms are not compatible with the designer or Blend, then I must abandon this otherwise awesome library.

I realize that I can just name the button and have it run the command. This works and the page is displayed properly in Blend and the VS editor. The real issue, though, is that I cannot use ActionMessage without creating problems in the editors - and I know for sure I will be using them.

Can anyone help?
Jan 22 at 8:44 PM
Which Caliburn.Micro are you using? 2.0 or 1.52?
Jan 23 at 1:50 PM
Edited Jan 23 at 1:59 PM
Thanks for the reply!

I'm using 1.5.2.

I have searched for a way to download version 2. It's in an Alpha stage and downloads are not offered. What do you know that I do not?
Jan 24 at 1:28 AM
you can get V2 via Source tab and download a zip file...

well for starters neither of those methods are necessary but if you choose to go that route that is fine with the use of the or Interactivity approach or Message.Attach but as to the reason why it's not working either situation is a mystery.. Both options should work just fine. Try the option below and see if it throws a fit...

option 3
<Button x:Name="ComfirmCommand" Content="Comfirm?" />
anyone can download the alpha source just have to go to the right location to get it

Image
Jan 24 at 7:00 AM
NuGet is the preferred way to download/use Caliburn.Micro.
Also 2.0-alpha is available there (you have to select show PreReleases).
Jan 24 at 12:53 PM
I have version 2 loaded, but now the Bootstrapper is not supported? I'll start searching, but what's the correct way to setup the project now?
Jan 24 at 1:18 PM
Ok - I have the bootstrapper working. I had to make the constructor public instead of static and call base(true). Then inside the constructor make a call to base.Start().
        public AppBootstrapper() : base(true)
        {
            --- other startup code
            Start();
         }
Then, in the OnStartup override, make a call to DisplayRootViewFor...
        protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
        {
            // do custom code here which you want to run on startup
            DisplayRootViewFor<MainWindowViewModel>();
            base.OnStartup(sender, e);
        }
So, back in action and the XAML markup for cal:Message.Attach now works with Blend and the VS designer. BTW, the namespace for using cal: uses Platform:
xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platform"