I have a XAML window with multiple TextBoxes, each with a corresponding TextBlock
tag for a title. I would like to enable Alt-key shortcuts for this window (hold down the Alt key to show underlined letters in the TextBlock
titles, type one of those letters and focus should change to the corresponding TextBox
).
I've found out how to do a similar thing for menu items (place an underscore in the title for the menu), but how does one go about doing it for other items in a window in this case?
Instead of using TextBlock, use the Label
control. It has intrinsic support for associating a mnemonic with another control via it's Target
property. To choose the character that will represent the alt+ you simply prefix it with an _
(underscore) in the Label's Content.
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