Message.Attach, SayHello and CanSayHello

Feb 4, 2011 at 5:13 PM


I'm not sure whether this is intentional behavour, and would like a clarification.

I have ShellView with two buttons in a DataTemplate of an ItemsControl, which is bound by Caliburn.Micro to Items.
(Two buttons just demonstrate to me the different methods, in case they operated differently - but they don't)
Where ShellViewModel is    public class ShellViewModel : Conductor<IMyItem>.Collection.OneActive, IShell
MyItem is a test class. And for my test, I only have one MyItem in Items.

I have "CanShow" and "Show" property and method on both the ShellViewModel and MyItem.
The "Show" method will execute on either ShellViewModel or MyItem, but never both.
The "CanShow" property on MyItem never executes, and only ever executes on ShellViewModel

I was expecting both the "CanShow" and "Show" property and method on both the ShellViewModel and MyItem to execute - bubbling up.

Please can you advise.

        <ItemsControl x:Name="Items" Grid.Row="2" HorizontalAlignment="Center">
                    <StackPanel Orientation="Vertical" />
                    <Border BorderThickness="5" BorderBrush="AliceBlue">
                            <TextBlock Text="{Binding Text1}"/>
                            <Button cal:Message.Attach="Show1" Margin="8">
                                <Grid Width="100">
                                        <TextBlock VerticalAlignment="Top"
                                               Text="TOP of button" />
                                        <Image Source="{Binding Icon}"
                                        <TextBlock Text="BOTTOM of Button" HorizontalAlignment="Center" />
                            <Button Content="Button 2">
                                    <i:EventTrigger EventName="Click">
                                        <cal:ActionMessage MethodName="Show2" />
                            <TextBlock Text="{Binding Text3}"/>

Feb 4, 2011 at 5:22 PM

Bubbling only takes the first match that it finds.

Feb 4, 2011 at 5:36 PM


But what about CanShow. It only ever executes on the parent, ShellViewModel
Is this intended?


Feb 4, 2011 at 6:00 PM

Can you send me a sample project that reproduces the problem? Please email it to robertheisenberg at hotmail dot com

I will check it out and see if there is a bug that needs fixing.