ChildWindow Action Message not invoked when defined in DataTemplate

Topics: Actions & Coroutines
Jun 8, 2011 at 3:53 AM

Hi,

I am using the DevExpress BarManager control in my project.

In this control the Buttons and other controls to appear on toolbars etc  are defined in a DataTemplate in the UserControl.Resources.

    <UserControl.Resources>
        <DataTemplate x:Key="dxTestBarTemplate">
            <dxb:BarManagerActionContainer >
                <dxb:BarButtonItem x:Name="btnTest"
                                   cal:Message.Attach="[Event ItemClick] = [Action TestItemClick()]"
                                   IsVisible="True"
                                   Content="Tester"
                                   Hint="Test this hint"  />
            </dxb:BarManagerActionContainer>
        </DataTemplate>
    </UserControl.Resources>

You will see that I have attached a cal:Message to to the ItemClick event on the BarButtonItem.

 Everything works perfectly when the DevExpress BarManager View is a standard UserControl.

 However, If I try to use the same xaml in a modal ChildWindow instantiated through IWindowManager.ShowDialog the Action message is never invoked.

 var model = (SampleViewModel) IoC.GetInstance( typeof (SampleViewModel), null );
WindowManager.ShowDialog( model);

All the other bindings and attached messages work fine.

 Any idea's on how I might get this to work?

 I can upload a sample app - but DevExpress Silverlight controls will be required to compile etc.

 Regards AndyB

Coordinator
Jun 8, 2011 at 5:43 PM

Hmmm. I'm not sure. Is your view a UserControl (such that CM generates the ChildWindow) or is it actually a ChildWindow? Whichever one it is....try the opposite and see if that changes anything. Just a wild guess....

Jun 9, 2011 at 2:30 AM

Hi Rob,

Thank you for your reply and, of course, for the Caliburn Micro framework which is great to work with.

I discovered that this bug is specific to IE9.  ( or at least that the same xap works correctly in Firefox and Opera but not IE9!).

Silverlight version 4.0.60310.0 IE9 Version 9.0.8112.16421

Perhaps there is some security setting, Silverlight implementation bug, DevExpress issue etc.

I have a work around where I do not use the WindowsManager/ChildWindow for views incorporating  DevExpress BarMangers.

Probably too obscure to investigate further.

Thanks once again for your response and your framework.

Best regards AndyB