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

273 Views Asked by At

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.

1

There are 1 best solutions below

2
On

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.