Getting error XDG0008 when trying System.Windows.Controls.Ribbon example

Nicholas Piazza 466 Reputation points
2022-10-26T23:06:57.89+00:00

Coded the example shown in Microsoft documentation for System.Windows.Controls.Ribbon with URL: https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.ribbon.ribbon?view=windowsdesktop-6.0. I had to modify MainWindow.xaml.cs to avoid an error using the code
`using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls.Ribbon;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CtrlRibbonRibbon;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : RibbonWindow
{
public MainWindow ()
{
InitializeComponent ();
}
}
`
However, the MainWindow.xaml reports the error: The name "RibbonWindow" does not exist in the namespace "clr-namespace:System.Windows.Controls.Ribbon". at line 4 of the following XAML
<ribbon:RibbonWindow x:Class="CtrlRibbonRibbon.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon"
Title="MainWindow"
x:Name="RibbonWindow"
Width="640" Height="480">

The documentation shows that RibbonWindow is a class in System.Windows.Controls.Ribbon and the dependencies show that namespace has been loaded. So why am I getting that error?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,362 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,161 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hui Liu-MSFT 17,306 Reputation points Microsoft Vendor
    2022-10-27T06:31:22.543+00:00

    You could replace the code xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon" with the following code

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

    complete code:

    xaml:

    <ribbon:RibbonWindow x:Class="CtrlRibbonRibbon.MainWindow"  
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
            xmlns:local="clr-namespace:CtrlRibbonRibbon"  
            xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"  
            mc:Ignorable="d"  
            Title="MainWindow" Height="450" Width="800">  
        <Grid>  
              
        </Grid>  
    </ribbon:RibbonWindow>  
    

    Codebedhind:

    using System.Windows.Controls.Ribbon;

    public partial class MainWindow : RibbonWindow  
        {  
            public MainWindow()  
            {  
                InitializeComponent();  
            }  
        }  
    

    ----------------------------------------------------------------------------

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful