|
I'm investigating the best way to model a menu with MVVM, specifically how to handles user actions based on activating menu items. I'm working with the
Telerik RadRibbonView, but this applies to any menu system.
When a user activates a menu item, I want something to happen in the application. That could be any action; opening a screen, saving a document, etc. I don't want to tie all those actions into a MenuViewModel. Should I raise an event using the event
aggregator when a menu item is activated? If so, should I have one event for all items or and event per item? ie:
MenuItemActivatedEvent { Name = "Save" }
or
SaveMenuItemActivatedEvent
With the first approach I could have just one method on the MenuViewModel, with the second approach I'd need one method per menu item.
Is raising events the correct way to allow menu functionality?
|