views:

770

answers:

1

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?

+2  A: 

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.

Drew Marsh
Thanks, that's exactly what I needed :-)
DashRantic