A have a Button
with a Command
. I want to display the InputGestureText
as a ToolTip
for every button that contains a command.
This is what I tried:
<n:ImageButton x:Name="NewRecordingButton" Text="Recording"
Command="util:Commands.NewRecording"
ToolTip="{Binding Source=util:Commands.NewRecording, Path=InputGestureText}"
ToolTipService.Placement="Top" ToolTipService.HorizontalOffset="-5"/>
I removed some elements for brevity.
I'm trying to achieve a similar result as a MenuItem
. I want to display the shortcut if the user hovers the mouse on top of the button.
The
MenuItem
has a propertyInputGestureText
, when is not set it will check whether the item'sCommand
is aRoutedCommand
and will show the display string for the firstKeyGesture
it can find.You can achieve the same thing via a converter (works only with
RoutedCommand
):Usage: