views:

28

answers:

1

I'm working on a PowerPoint Add-In project.

I'm trying to create a RibbonToggleButton in code-behind but I can't do it the way I thought,

RibbonToggleButton toggleButton = new RibbonToggleButton();

Is it possible to create RibbonControls in code-behind and not the RibbonDesigner or RibbonXML?

+1  A: 

According to the docs:

You can create a RibbonToggleButton at run time by using the CreateRibbonToggleButton method of the RibbonFactory object.

It looks like you get at the RibbonFactory via the RibbonBase.Factory property.

You may also want to look through this walk-through.

Jon Skeet