Search code examples
wpfmvvmribbon

Build Ribbon in full MVVM with Dot Net 4.5


we have several applications in FULL MVVM using the Ribbon from Microsoft. And it works fine, it's a great and flexible component :)

I was surprised to have to build my own templates and bindings to be able to use the ribbon in MVVM (I didn't find those files anywhere).

We are still using the Ribbon DLL from Microsoft (released around 2010 ) and can't switch to the ribbon existing in the Framework because it doesn't work with our Templates/bindings. Nothing happens/appears. Using the XAML description, everything is fine. I'm probably missing something. Does someone use it in full MVVM and which approach did you use to get it working ? Does the Framework contains the Templates and bindings hided somewhere ?

To summarize, how to use the ribbon included in the 4.5 Framework in FULL MVVM ?

Thanks for your help guys :)


Solution

  • If you target .NET Framework 4.5 or later you could add a reference to System.Windows.Controls.Ribbon.dll and use the built-in RibbonControl as-is:

    <Ribbon />
    

    You should be able to use this one more or less the exact same way as you use your current version. The templating of a control has nothing to do with MVVM. And of course the control comes with a default template.