开发者

How to set up extended tool tips in WPF Ribbon Control?

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 assi开发者_开发知识库gn 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜