简体   繁体   中英

Dynamically add tabs to ribbon with Windows Ribbon Framework and C#

I would like to know if there is any way to add tabs dynamically using Windows Ribbon Framework and C#.

I am developing an application which I need it to be extensible. Using Managed Extensibility Framework, I want the application to dynamically install new tabs on the ribbon for discovered plugins.

I can't rely on the XML markup for the ribbon because plugins can be added and discovered later.

If there is a way to install new tabs at runtime, I will want new plugins to be added on ribbon tabs and expose their functionality through buttons on installed tabs.

I will also be grateful if I am directed on how the experts do it. Thanks in advance.

I think that's not possible in such a dynamic way. I see two alternatives here, both of them probably not what you intended though:

  • Create a markup resource for each combination of plugins that you might have in the application and load the appropriate resource using IUIFramework::LoadUI . This is of course pretty static and therefore Kind of contradicts with the idea of a plugin System.
  • Define a "contextual tab" for each of the plugins. Those tabs can be shown/hidden dynamically during runtime. You won't be able to create a new contextual tab however during runtime so this is again kind of a static solution.

As said, both of those not really solutions for your problem, but at least an answer to the question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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