【问题标题】:Create Ribbon in WPF App with with Visual Studio 2017使用 Visual Studio 2017 在 WPF 应用程序中创建功能区
【发布时间】:2017-03-10 18:26:49
【问题描述】:

我在 Visual Studio 2017 中为 Windows 经典桌面创建了一个新的 WPF 应用程序。

我试图找到如何添加功能区,但我发现的内容与 Visual Studio 的旧版本有关,并且似乎无法在这里工作,或者我不明白如何做.

如何使用 Visual Studio 2017 在 XAML/WPF 中添加功能区控件?

编辑:

我已经用这个 XAML 代码获得了一些东西:

<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>

这是一个东西,但它是另一个窗口中的功能区窗口;功能区栏不像带有功能区的普通应用程序那样包含窗口名称和按钮。

【问题讨论】:

标签: wpf xaml ribbon visual-studio-2017


【解决方案1】:

您需要添加以下参考:System.Windows.Controls.Ribbon

然后使用 RibbonWindow 代替 Window:

<RibbonWindow ...

还要记得更改部分的基类:

using System.Windows.Controls.Ribbon;

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

【讨论】:

    【解决方案2】:

    我认为您需要为 vs2017 安装 Wpf 功能区,然后您可以创建功能区应用程序

    【讨论】:

    猜你喜欢
    • 2012-05-30
    • 1970-01-01
    • 2018-03-29
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多