Caliburn micro directing the message.attach to the desired viewmodel

Oct 17, 2012 at 11:05 AM

I've added another view named LogicView inside my MainView. I made a contextmenu for LogicView that will publish a message of "ConvertToCode()" when the menu item is clicked, but I'd like to send the message named ConvertToCode to my MainViewModel, not LogicViewModel. Otherwise, I have to use EventAggregator and publish the message from my LogicViewModel back to my MainViewModel, and this seems very redundant.

MainViewl.Xaml:

    <my:LogicView x:Name="logicView" AllowDrop="True">
          <my:LogicView.ContextMenu>
              <ContextMenu StaysOpen="True">
                    <MenuItem Header="Convert To Code"
                     cal:Message.Attach="ConvertToCode()"/> //I'd like to send this to mainviewmodel
              </ContextMenu>
          </my:LogicView.ContextMenu>
     </my:LogicView>


Is this possible to do in Caliburn Micro?

Oct 17, 2012 at 8:54 PM

you might have a look at action.target and action.targetwithoutcontext otherwise eventaggregator.