I've stumbled on this particular scenario in a modular Silverlight application.
I need to populate a context menu from one of the application screen, the problem is that multiple modules might want to add menu entries here.
The 2 solution we've come up with is:
- Use a event aggregator and publish the ContextMenuLoadEvent, modules listen for that event and add menu entries in the context menu
- Use a IOC container and register IPopulateContextMenu services from modules, then in the screen get all IPopulateContextMenu services and call Populate on them.
What do you think is the best approach and why?
Thanks,