backyardKiwi
backyardKiwi

Reputation: 199

How to programmatically add a RibbonTab to WPF Ribbon (October 2010 release)?

Does anybody know a way to programatically add a RibbonTab to a Mircosoft WPF Ribbon? I can't find an example or at least a property to use in neither documentation nor Ribbon's intellisense.

I found many entries all over the web suggesting something like: ribbon.Tabs.Add(...)

Unfortunately "Tabs" doesn't exist in the Ribbon class at all?! Was there an API change I can't find anything about or what's the trick?

Upvotes: 2

Views: 4313

Answers (2)

Gene Merlin
Gene Merlin

Reputation: 902

The Microsoft WPF Ribbon inherits from Selector, which inherits from ItemsControl. With that in mind, to add a tab programmatically, you would use the Items property to add the new RibbonTab object.

For example,

Ribbon.Items.Add(new RibbonTab())

Upvotes: 6

Aaj
Aaj

Reputation: 259

I haven't used the Microsoft WPF Ribbon much so I'm afraid I don't know, but I can however recommend the Microsoft Fluent Ribbon; I've had a lot more success implementing it, and found it significantly more flexible and intuitive...it's on the codeplex site if it's something you're interested in (presuming you haven't gotten too deep using the MS WPF Ribbon) - fluent.codeplex.com

Hope it helps,

Aj

Upvotes: 0

Related Questions