Search code examples
wpfxamlwpf-controlsribboncontrolslibrary

What is wrong with my use of the Ribbon control in a WPF application?


I have added a reference to RibbonControlsLibrary.dll. v4.0.0.11019. Then, I have the namespace declaration in my main window:

xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"

Then I try and use the ribbon in the top row of my main, outer, grid:

</Grid.ColumnDefinitions>
<r:Ribbon Title="ModuleRibbon" Grid.Row="0">
    <r:RibbonTab></r:RibbonTab>
    <r:RibbonTab></r:RibbonTab>
</r:Ribbon>

All this gives me is a compile error stating:

Error 25 The tag 'Ribbon' does not exist in XML namespace 'clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary'. Line 22 Position 10.

Every tutorial and guide I have found says to do what I have done. There are no Google results for the error message - minus the Line and Position and other project specific info.


Solution

  • According to MSDN Ribbon controls are in System.Windows.Controls.Ribbon assembly and not RibbonControlsLibrary as in your example. Declare your namespace like below and it should work:

    xmlns:r="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"