How to assign short-cut key to a button in WPF?
Googling gave me the answer as to append _ instead of '&' in standard Winforms.
So after I have done as below :
<Button Name="btnHelp" Content="_Help"></Button>
I did not find 'H' underlined.
That is first issue.
Second issue is that, how to execute that after pressing Alt + H at run-time. Say just to display a message box is sufficient for the example sake.
I am using C#, WPF
Thanks.
This is kind of old, but I ran into the same issue today.
I found that the simplest solution is to just use an AccessText element for the button's content.
<Button Command="{Binding SomeCommand}">
<AccessText>_Help</AccessText>
</Button>
When you press the Alt key, the 'H' will be underlined on the button.
When you press the key combination Alt+H, the command that is bound to the button will be executed.