3

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.

Daniel Oppong
  • 158
  • 1
  • 10

1 Answers1

0

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.

Daniel Lemke
  • 1,966
  • 18
  • 24
  • Thanks Lemke. I initially thought that will work since Excel is able to discover addins and add them as new tabs. I will try the alternatives as you suggested. – Daniel Oppong Jul 12 '16 at 07:24
  • Excel/Office doesn't use the Windows Ribbon Framework but a completely different implementation of the same UI concept. The add-in concept used in Office cannot be reused/adapted for your own application. – Daniel Lemke Jul 12 '16 at 11:51