tags:

views:

85

answers:

1

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

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.

A: 

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.

David Veeneman