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 so开发者_StackOverflow中文版mething 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?
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())
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
精彩评论