0
votes

I have a WPF app I'm writing using the Caliburn.Micro MVVM framework.

My ShellViewModel is a conductor and thus has ActiveItem and I'm able to switch between ActiveItems fine.

My problem comes to handling my application menu. It's in the ShellView.xaml markup and I have a "Save" menu item. I want this to pass off to the ActiveItems Save() method, and also bind to the CanSave guard property on the ActiveItem as well disabled when there is not an Active item or the Active Item doesn't support saving.

I can't see an easy way of handling case. Has any one else tried something similar, did they find a good way to do this with Caliburn.Micro?

I have other idea's on how to do this, but with everything else Caliburn.Micro offers, I feel I must be missing something simple.

Thanks in Advance.

1

1 Answers

0
votes

You could use the Event Aggregator to publish a Save event and have the active item, IsActive, handle the SaveEvent.

For the guard you could have the CanSave test a value that is shared between the ShellVM and an ActiveItem using MEF.