MenuItem action

Nov 26, 2010 at 5:58 AM

Hello.

Can some1 explain to me how can i create MenuItem using actionMessages in Caliburn Micro, that would invoke actions on multiple ViewModels(levels).

I understand how to bind MenuItem with viewModel, but im not sure how to bind vieModels commands themselfs once MenuItem action is invoked.

View(MenuItem action) --using Message.Attach--> ViewModel(action invoked) --this logic  im missing--> ViewModel(action invoked) ...

Hope i make sense ...

Coordinator
Nov 26, 2010 at 1:27 PM

My apologies, I didn't quite understand what you are trying to accomplish.

Dec 2, 2010 at 7:08 AM

Hi,

If i have a viewModel and a view the command bind is done using Message.Attach.

What if i want that this command triggers something on a different viewModel (or lets say on several viewModels)? How do i bind this using caliburn micro? 


Dec 2, 2010 at 8:54 AM

The attached property Message.Target should do the trick, supposing that you can reach the intended action handler walking on a property path from the ViewModel referenced in the MenuItem's DataContext:

<MenuItem Message.Target="{Binding Path.To.Different.ViewModel}" Message.Attach="MyActionName" ... />