如何开始使用 Microsoft 的 RibbonControlsLibrary?

发布于 2024-09-06 06:15:03 字数 1495 浏览 8 评论 0原文

我是 WPF 编程新手,决定通过尝试一些功能区控件库来尝试一下。 目前看起来最好的库是 Microsoft RibbonControlsLibrary。您可以在功能区许可页面上获取它。

到目前为止,我已经开始了一个新项目,将控件添加到了窗口,但我被卡住了:这是到目前为止的代码:

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="808" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:my1="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" WindowStyle="SingleBorderWindow">
    <Grid>
        <my1:Ribbon HorizontalAlignment="Left" Name="ribbon1" VerticalAlignment="Top" Height="165" Width="786" ShowQuickAccessToolbarOnTop="False" WindowIconVisibility="Visible" DataContext="{Binding}" Margin="0,-20,0,0">
            <my1:Ribbon.ApplicationMenu>
                <my1:RibbonApplicationMenu Visibility="Hidden" IsEnabled="True" />
            </my1:Ribbon.ApplicationMenu>
            <my1:RibbonTab Label="Tab1" Name="rtab1" >
            </my1:RibbonTab>
            <my1:RibbonTab Label="tab2" Name="rtab2"/>
        </my1:Ribbon>

    </Grid>
</Window>

问题
1) 在哪里可以找到此功能区控件的示例?我尝试过谷歌搜索,但没有找到任何有用的结果。
2)如何将项目添加到特定的功能区选项卡?我迷失在属性网格中的所有这些属性中。到目前为止我还没有找到专门用于此目的的设计师。
3) 如何切换设计器以显示我在 TabPage2 上放置的图标/按钮/...?

(仅供参考:流畅的功能区库似乎对我不起作用,因为我无法摆脱 ApplicationMenu。)

I'm new to WPF programming and decided to give it a shot by trying out some ribbon control libraries.
The library that looks best for now is the Microsoft RibbonControlsLibrary. You can get it on the ribbon licensing page.

So far I've started a new project, added the control to the windows, but them I'm stuck: This is the code so far:

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="808" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:my1="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" WindowStyle="SingleBorderWindow">
    <Grid>
        <my1:Ribbon HorizontalAlignment="Left" Name="ribbon1" VerticalAlignment="Top" Height="165" Width="786" ShowQuickAccessToolbarOnTop="False" WindowIconVisibility="Visible" DataContext="{Binding}" Margin="0,-20,0,0">
            <my1:Ribbon.ApplicationMenu>
                <my1:RibbonApplicationMenu Visibility="Hidden" IsEnabled="True" />
            </my1:Ribbon.ApplicationMenu>
            <my1:RibbonTab Label="Tab1" Name="rtab1" >
            </my1:RibbonTab>
            <my1:RibbonTab Label="tab2" Name="rtab2"/>
        </my1:Ribbon>

    </Grid>
</Window>

Questions:
1) Where can I find samples for this ribbon control? I've tried googling, but came up with nothing useful.
2) How to add items to specific ribbon tabs? I'm lost in all these properties in the property grid. So far I havent found a designer for that purpose.
3) How can I switch the designer to show me what icons/button/... I placed on TabPage2?

(FYI: The fluent ribbon library does not seem to work for me, because I can't get rid of the ApplicationMenu.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇纵 2024-09-13 06:15:03

找到了一个很棒的示例/教程:

http://windowsclient.net/downloads /folders/hands-on-labs/entry76491.aspx

该示例提供了一份包含说明的手册和一些测试项目,其中包含实现功能区控制的分步说明。

尽管我对 WPF 完全陌生,但我设法从示例中提取必要的类,以便在我的程序中提供基于 ribon 的菜单。

Found a great sample/tutorial:

http://windowsclient.net/downloads/folders/hands-on-labs/entry76491.aspx

The sample provides a manual with explanations and some test projects with step by step instructions to implement the ribbon control.

Though I'm totally new to WPF, I managed to extract necessary classes from the sample to provide a ribon based menu in my program.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文