Feb 21, 2013 at 5:29 PM
Edited Feb 21, 2013 at 5:31 PM
I don't think that my employer will allow me to publish the code for the factory we are using.
But i will try to explain the basic concept:
On the ViewModel side we've got:
RibbonTabViewModel which has a list of
RibbonGroupViewModel which has a list of
continue this list for everything you need
Those all have properties like DisplayName, SmallImage, LargeImage etc..
In addition the RibbonTabViewModel has a Context property to realize contextual tabs.
The factory is kind of simple. It gets fed by an ObservableCollection of RibbonTabViewModels, listens to changes to that collection and creates the necessary RibbonTabs.
Then it listens to changes made to the ObservableCollection of RibbonGroupViewModels in each RibbonTabViewModel and creates the necessary RibbonGroups.
Then it listens to changes made to the ObservableCollection of CommandViewModels (the base class for all elements in a RibbonGroupViewModel) in each RibbonGroupViewModel and creates the necessary ribbon controls.
Of course there is more logic involved to handle things like context changes, building the applicationmenu/backstage etc. that's the reason why our "factory" class is called RibbonManager, as it handles all interaction with the Ribbon.
I hope this helps, at least, a bit. I'm afraid i'm not allowed to expose more of the inner workings of our RibbonManager. :-(