Microsoft.Ribbon binding View/ViewModel

Topics: Getting Started, UI Architecture
Apr 17, 2012 at 9:36 AM
Edited Apr 17, 2012 at 10:04 AM

What i try to achieve is, to bind views as tabs to the Microsoft Ribbon control at the application startup.
These Tabs will be located over several Modules. 

In UI Project looks like this:


public class ShellViewModel : Conductor<IView>.Collection, IShell
    private readonly IWindowManager windowManager;
    private IEnumerable<IRibbonTabViewModel> ribbonTabs;
    public IEnumerable<IRibbonTabViewModel> RibbonTabs
        get { return ribbonTabs; }
        private set { ribbonTabs = value; }

    public ShellViewModel(IWindowManager windowManager)
        this.windowManager = windowManager;

    public ShellViewModel(IWindowManager windowManager, IRibbonTabViewModel[] ribbonTabs)
        : this(windowManager)
        RibbonTabs = ribbonTabs;


In my View i try to bind via the x:Name attribute:

<ribbon:Ribbon x:Name="RibbonTabs">            
            <TextBlock Text="{Binding DisplayName}" />

My Solution Structure:

dojo.core (shared components)
dojo.knight (module assembly)
dojo.samurai (module assembly)
dojo.ui (application) 

Each module assembly has it`s own views and associated view model according with the following structure:


// project
|  +--MyView
|   +--MyViewModel
+-- Module 

An example for a view that should inserted to a RibbonTab looks like this:
public class KnightRibbonTabViewModel : RibbonTabViewModel
    public KnightRibbonTabViewModel(IRibbonGroupViewModel[] groups)
        : base(groups)
        this.DisplayName = "Knight";
<UserControl x:Class="dojo.knight.Views.KnightRibbonTabView"
             d:DesignHeight="300" d:DesignWidth="300">
        <TextBlock Text="Some!" />

I receive this when the application is started ->
It seems like the views were not resolved automatically. Waht is the correct way to acvhieve this?
Thanks in advance