Example request load RibbonGroupBox or RibbonTabItem from resource

Jul 21, 2010 at 2:37 PM
I think I am missing something but just can't get this to work. I have a content view that is dynamically loaded at run time and needs it's ribbon to be populated with context sensitive items. Can I create these RibbonGroupBox items and load them from a UserControl.Resources section? If not, is there an equivalent approach? It is sort of like how Outlook 2010 will load different ribbon items into a given tab when Mail is active vs. when Calendar is active. TIA
Coordinator
Jul 21, 2010 at 2:57 PM
Edited Jul 21, 2010 at 2:58 PM

I think you need add all your elements and play with their Visibility property.
For example, you can add dependency properties (for ex., in window):

... Visibility MailRibbonItemVisibility ...
... Visibility CalendarRibbonItemVisibility ...

in XAML bind such context sensitive items Visibility with the property:

....
RibbonGroupBox Visibility={Binding MailRibbonItemVisibility, ElementName=window }....
...

Daniel

Jul 21, 2010 at 3:13 PM
I have done that but it is leading to some duplication of XAML I was hoping to be able to workaround. Not tragic in the end but would be nice to be able to share these layouts between tabs.