Modifying a ribbon control at runtime-Collection of common programming errors

You can switch modes at runtime depending on what is defined in the markup – see here for details:

After modes are defined in markup, they can be easily enabled or disabled in response to contextual events. As mentioned previously, Ribbon applications always start in the default mode 0. After the application has initialized and mode 0 is active, the set of active modes can be changed by calling the IUIFramework::SetModes function.

There is a comment here to the effect that changes at runtime are quite limited – this is in regard to a third-party wrapper, note.

You can dynamically add items at runtime only to the galleries controls:

ComboBox, SplitButtonGallerty, DropDownGallery and InRibbonGallery

If you know what you want to add from advance you can use ContextualTabs and ApplicationModes to change the visibility of (predefined) tabs and groups.

Unfortunately, you can add dynamically groups at runtime.

Note this is a limitation in the Windows Ribbon Framework and not in the wrapper library.