Jul 16, 2012 at 9:25 PM
Edited Jul 16, 2012 at 9:28 PM
It would need massive changes to the Ribbon to enable full MVVM support, which i think, is what you want.
By the way, i think you destroy the automatic sizing/reducing by simply making RibbonTabItem a ContentControl, don't you?
I took a simpler approach at work and just made a factory which holds a reference to the ribbon and a list of RibbonTabViewModel.
The class layout looks something like this:
RibbonTabViewModel which has a list of RibbonGroupViewModel.
RibbonGroupViewModel which has a list of RibbonCommandViewModel.
RibbonCommandViewModel is subclassed by RibbonComboBoxCommandViewModel, RibbonCheckBoxCommandViewModel, etc.
The factory then listens for changes to the list of RibbonTabViewModels and creates the RibbonTabItems filled with the control contained in the RibbonTabViewModel. I don't listen for changes made to the list of RibbonGroupViewModel, because the Ribbon shouldn't
change groups or controls on the fly (would confuse users i think).