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.

Help!

有帮助吗?

解决方案

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"

其他提示

The XML namespace that you have used will only work with the Ribbon Control library that is downloaded separately from the .NET Framework... I believe that you can still download that version from the Microsoft Ribbon for WPF October 2010 page on MSDN. This was the only way to use the Ribbon Control library before it was included in the Framework version 4.5.

If you are using the Ribbon Control library that is included with the .NET Framework, then you should use the following XML namespace:

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top