Pergunta

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?

Foi útil?

Solução

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())

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top