简体   繁体   English

功能区选项卡上的通用按钮WPF

[英]Common Button on Ribbon tabs wpf

I'm using Ribbon in my WPF application. 我在WPF应用程序中使用Ribbon。 Is there any change that I can have the same button on every tab or Ribbon? 我可以在每个选项卡或功能区上使用相同的按钮吗? I don't want to create exactly the same seperately and handle it every time. 我不想单独创建完全相同的内容并每次都处理它。 Is it possible? 可能吗?

In that situation how would differentiate between the buttons and their "click" events? 在那种情况下,如何区分按钮及其“单击”事件? Really the best way to handle this is to create a ViewModel with a series of ICommands to handle the different button functions. 确实,解决此问题的最佳方法是使用一系列ICommands创建一个ViewModel来处理不同的按钮功能。 It will make it a million times easier to test later and much easier to view instead of following the spaghetti code of all of the "Button_Click" events. 这样一来,无需遵循所有“ Button_Click”事件的意大利面条式代码,就可以更轻松地进行一百万次的测试和以后的查看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM