如何在WPF Ribbon Control中设置扩展工具提示?

发布于 2024-09-14 23:06:57 字数 989 浏览 7 评论 0原文

我一直在使用新的 Microsoft Ribbon for WPF 并查看 WPF 团队博客中发布的教程。 扩展工具提示教程 显示此屏幕截图:

扩展工具提示屏幕截图 http://blogs.msdn.com/resized-image。 ashx/__size/800x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-64/0871.Post6-_2D00_-Rich-RibbonToolTips.png

不幸的是,该教程没有显示标记来创建该工具提示。

我有几个关于屏幕截图的问题,希望有人能帮助我:

  • 如何在工具提示中嵌入段落分隔符,就像他们在屏幕截图中所做的那样?
  • 如何为 RibbonButton 分配 Control 键快捷键?

至于第二个问题,我可以看到他们如何在工具提示中嵌入“(Ctrl+Shift+C)”——我猜他们只是将其作为 ToolTipTitle 的一部分。我想弄清楚的是如何分配 Ctrl 键组合来触发按钮按下。

感谢您的帮助。

I have been playing with the new Microsoft Ribbon for WPF and looking at the tutorials published in the WPF Team Blog. The tutorial for extended tool tips shows this screen shot:

Extended tool tip screen shot http://blogs.msdn.com/resized-image.ashx/__size/800x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-64/0871.Post6-_2D00_-Rich-RibbonToolTips.png

Unfortunately, the tutorial doesn't show the markup to create that tool tip.

I've got a couple of questions about the screen shot that I am hoping someone can help me with:

  • How do I embed a paragraph break in the tool tip, like they did in the screen shot?
  • How do I assign a Control-key shortcut to a RibbonButton?

As to the second question, I can see how they embedded the '(Ctrl+Shift+C)' in the tool tip--I'm guessing thay just made it part of the ToolTipTitle. What I am trying to figure out is how to assign the Ctrl-key combo to trigger the button press.

Thanks for your help.

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

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

发布评论

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

评论(1

苏佲洛 2024-09-21 23:06:57

找到了我的答案——实际上非常简单。

第一个问题:如何嵌入换行符?只需嵌入
;换行符应出现的位置:

ToolTipDescription="Makes the Note List View active.

Use the Note List View to browse Notes and to search for them by Tags."

第二个问题:如何分配 Control 键组合?在 WPF 中,我们不会为控件分配控制键。相反,我们创建一个 标记并将控制键添加到该标记。我们将每个控制键分配给与它所分配到的控件相同的 ICommand。例如,下面是 Ribbon 控件中三个不同按钮的一组输入绑定:

<!-- Control-key shortcuts -->
<ribbon:RibbonWindow.InputBindings>
    <KeyBinding Command="{Binding NewNote}" Key="A" Modifiers="Ctrl"/>
    <KeyBinding Command="{Binding DeleteNote}" Key="D" Modifiers="Ctrl"/>
    <KeyBinding Command="{Binding SetNoteTags}" Key="T" Modifiers="Ctrl"/>
</ribbon:RibbonWindow.InputBindings>

这些输入绑定未在 Ribbon 控件中定义。相反,它们是在窗口级别定义的 - 我将其放在 标记之后。对于用户来说,它们看起来就像已分配给功能区控件一样。

Found my answers--actually turned out to be pretty simple.

First question: How to embed newlines? Simply embed a ; character where the newline should appear:

ToolTipDescription="Makes the Note List View active.

Use the Note List View to browse Notes and to search for them by Tags."

Second question: How to assign a Control-key combination? In WPF, we don't assign a control-key to a control. Instead, we create an <InputBindings> tag and add our control keys to that tag. We assign each control-key to the same ICommand as the control that it is assigned to. For example, here is a set of input bindings for three different buttons in a Ribbon control:

<!-- Control-key shortcuts -->
<ribbon:RibbonWindow.InputBindings>
    <KeyBinding Command="{Binding NewNote}" Key="A" Modifiers="Ctrl"/>
    <KeyBinding Command="{Binding DeleteNote}" Key="D" Modifiers="Ctrl"/>
    <KeyBinding Command="{Binding SetNoteTags}" Key="T" Modifiers="Ctrl"/>
</ribbon:RibbonWindow.InputBindings>

These input bindings aren't defined in the Ribbon control. Instead, they are defined at the window level--I put mine just after the <Window.Resources> tag. To the user, they appears the same as if they had been assigned to the Ribbon control.

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