[英]Using Ribbon control with PRISM
I want to create a composite wpf application with ribbon control using Prism, and I have some thoughts about commanding: 我想使用Prism创建一个具有功能区控制的复合wpf应用程序,并且对命令有一些想法:
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? 我应该使用Event Aggregator在视图模型之间进行通信吗? maybe Composite command? 也许复合命令? any other approch? 还有其他办法吗?
Thanks. 谢谢。
Because it's a different Views/ViewsModels - EventAggregator is a way to go. 因为它是不同的Views / ViewsModels-EventAggregator是一种解决方法。 You use command on a View with ribbon that executes Method on RibbonViewModel which will Publish that event. 您可以在具有功能区的视图上使用命令,该命令在RibbonViewModel上执行Method,它将发布该事件。 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) 如果您使用功能区作为菜单-那么也许应该使用PRISM的导航来打开其他视图(在不同区域)
这是复合命令的典型方案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.