6
votes

I've created a new WPF App in Visual Studio 2017 for Windows Classic Desktop.

I've tried to find how to add a Ribbon, but what I've found is related to old versions of Visual Studio and don't seem to work here, or I've didn't understood how to do it.

How can I add a Ribbon control in XAML/WPF using Visual Studio 2017?

EDIT:

I've obtained something with this XAML code:

<Window x:Class="WMathTest.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:ribbon="clr-namespace:System.Windows.Controls.Ribbon.Primitives;assembly=System.Windows.Controls.Ribbon"
        xmlns:local="clr-namespace:WMathTest"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <DockPanel>
        <Ribbon>
            <ribbon:RibbonTabsPanel></ribbon:RibbonTabsPanel>

        </Ribbon>

    </DockPanel>
</Window>

enter image description here

It's something but it's a Ribbon window inside another window; the ribbon bar does not contain window name and buttons as in normal applications with ribbons.

2

2 Answers

4
votes

You need to add the following Reference: System.Windows.Controls.Ribbon

Then use a RibbonWindow instead of a Window:

<RibbonWindow ...

Also remember to change the base class of the partial:

using System.Windows.Controls.Ribbon;

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

I think you need to install Wpf ribbon for vs2017 and then you can create a ribbon app