I want to create a composite wpf application with ribbon control using Prism, and I have some thoughts about commanding:
The ribbon tab is in different view, so i guess it will have开发者_运维技巧 specific view model. but the command should be in another view model, because when I click on button in the ribbon, I want to do some action in the view below, so how can I bind it? should I use Event Aggregator to communicate between the view models? maybe Composite command? any other approch?
Thanks.
Because it's a different Views/ViewsModels - EventAggregator is a way to go. You use command on a View with ribbon that executes Method on RibbonViewModel which will Publish that event. Other views subscribe to that event.
If you use Ribbon as a menu - then maybe you should use PRISM's Navigation to open other views (in different region)
This is the typical scenario for composite commands
精彩评论