2

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?

Chris
  • 6,272
  • 9
  • 35
  • 57
backyardKiwi
  • 199
  • 1
  • 2
  • 10

2 Answers2

6

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())
Gene Merlin
  • 882
  • 7
  • 5
  • 1
    Oh - sometimes it's just too easy to belive... Thanks for opening my eyes ;-) – backyardKiwi Dec 06 '10 at 09:57
  • Now I "just" have to decide whether I'll use Micosoft Fluent Ribbon or Microsoft WPF Ribbon - they both look kind of nice on first glance. I however wonder which one will prevail in the long run - Microsoft has a history of discontinuing concurring products... – backyardKiwi Dec 06 '10 at 10:02
0

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

Aaj
  • 259
  • 3
  • 16
  • Thanks, I'll look right into it. You assumed right - I just started a new project so your solution might be a nice alternative that I didn't notice before ;-) – backyardKiwi Nov 30 '10 at 22:03