MVVM, WPF Ribbon V4, with Prism This weekend I've been having one heck of a time getting WPF Ribbon v4 working with MVVM and Prism (using unity). After much trial and error, I believe I have it working. I was hoping someone could take a look at it and give me some feedback.

RibbonRegionAdapter.cs

public class RibbonRegionAdapter : RegionAdapterBase&lt;Ribbon&gt;
{
    private Ribbon _ribbonTarget;

    public RibbonRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
        : base(regionBehaviorFactory)
    {

    }

    protected override void Adapt(IRegion region, Ribbon regionTarget)
    {
        _ribbonTarget = regionTarget;

        region.Views.CollectionChanged += delegate {  
            foreach (RibbonTab tab in region.Views.Cast&lt;RibbonTab&gt;())  
            {  
                if (!_ribbonTarget.Items.Contains(tab))  
                {  
                    _ribbonTarget.Items.Add(tab);  
                }  
            }  
        };  
    }

    protected override IRegion CreateRegion()
    {
        return new SingleActiveRegion();
    }
}


BootStrapper.cs - To register our regionAdapter

    protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
    {
        RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings();

        if (mappings != null)
        {
            mappings.RegisterMapping(typeof(Ribbon), this.Container.Resolve&lt;RibbonRegionAdapter&gt;());
        }


        return mappings;
    }


CarRibbonTab.xaml

&lt;ribbon:RibbonTab x:Class="CarManager.Modules.CarModule.Views.CarRibbonTab"
               xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Header="Officers"&gt;
    &lt;ribbon:RibbonGroup Header="New"&gt;

    &lt;/ribbon:RibbonGroup&gt;
    &lt;ribbon:RibbonGroup Header="Manage"&gt;
        &lt;ribbon:RibbonButton Label="Make"
                                LargeImageSource="..\Resources\make.png" /&gt;
        &lt;ribbon:RibbonButton Label="Inventory"
                                LargeImageSource="..\Resources\Inventory.png" /&gt;
        &lt;ribbon:RibbonButton Label="Assignments" /&gt;
    &lt;/ribbon:RibbonGroup&gt;
&lt;/ribbon:RibbonTab&gt;


CarRibbonTab.cs - Code behind for the View

public partial class CarRibbonTab: RibbonTab
{
    public CarRibbonTab()
    {
        InitializeComponent();
    }
}


Shell.xaml - Just showing the ribbon control

&lt;ribbon:Ribbon DockPanel.Dock="Top" Title="CarManager" prism:RegionManager.RegionName="RibbonRegion"&gt;
    &lt;ribbon:Ribbon.ApplicationMenu&gt;
        &lt;ribbon:RibbonApplicationMenu SmallImageSource="Images\Icon.png"&gt;
            &lt;ribbon:RibbonApplicationMenuItem Header="Exit"
                                              ImageSource="Images\ExitIcon.png"/&gt;
        &lt;/ribbon:RibbonApplicationMenu&gt;
    &lt;/ribbon:Ribbon.ApplicationMenu&gt;

&lt;/ribbon:Ribbon&gt;


CarModule.cs - registering the view with the region 

    public class CarModule: IModule
    {
        private readonly IRegionManager  _regionManager;
        private readonly IUnityContainer _container;
        public MenuItemViewModel MenuItem;

        public CarModule(IUnityContainer container, IRegionManager regionManager)
        {
            _container     = container;
            _regionManager = regionManager;
        }

        public void Initialize()
        {
            //Ribbon
            _container.RegisterType&lt;Object, CarRibbonTab&gt;("CarRibbonTab");

            _regionManager.AddToRegion("RibbonRegion", _container.Resolve&lt;CarRibbonTab&gt;());
        }
    }
Not sure whether we have many Prism specialists on Code Review and I haven't worked with it for a while, so maybe my comments are incorrect at points.  


I do not really like the way you're handling region.Views.CollectionChanged event. This event provides a lot of information in eventArgs but you're ignoring it. Firstly you do not handle removing views at all. Secondly instead of iterating through all views every time I would use those from eventArgs (NewItems property).  
I believe generally it is better to have views isolated from regions in terms of concrete types. Your view is not isolated since it has to inherit RibbonTab class. Maybe it is not an issue here and I'm not sure whether it should be changed somehow, it just looks strange to me.