If you're declaring MenuItem
s, I've always seen their Header
properties declared like this:
<MenuItem Header="_Edit">
<MenuItem Header="_Undo"/>
<MenuItem Header="_Redo"/>
</MenuItem>
instead of like this:
<MenuItem Header="Edit">
<MenuItem Header="Undo"/>
<MenuItem Header="Redo"/>
</MenuItem>
Is there a reason for this or is it just a convention? In the designer it seems to affect nothing whether I have the underscore behind or not.
Its to designate the keyboard shortcut.
"_Edit"
means that CTRL + E will activate that menu item, whereas
"E_dit"
means that CTRL + D will work.
Also, the underscored letter will have an underline when in focus to clue the user in to the keyboard shortcut.
From MSDN
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