I want to set my button tooltip by showing its shortcut key command.
<Button Command="Cut"
CommandTarget="{Binding ElementName=textBox}"
Content="{Binding RelativeSource={RelativeSource Self},Path=Command}"
ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.InputGestures[0]}"/>
But, it shows the result:

It shows "Ctrl+X, Ctrl+X". I just want only a "Ctrl+X". Please help me. I am the beginner.
I just found the easy way here.
<Button Command="Cut"
DockPanel.Dock="Top"
CommandTarget="{Binding ElementName=textBox}"
Content="{Binding RelativeSource={RelativeSource Self},Path=Command}"
ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.InputGestures[0].DisplayString}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With