问题
I have a label next to a text box which has a short cut key. The XAML for the label looks like:
<Label>Enter your _Name</Label>
Where if you press alt+N it sets focus in the textbox where you would enter your name.
I'd like the letter N to be underlined so that when the user sees the label it looks like:
Enter your Name (well N is bold here, but I'd like it be underlined :))
Thanks for your help!
回答1:
The N will automatically be underlined when the Alt key is pressed. You'll see this behavior in any Windows application as it's a system-wide setting.
If you want to always get the underline without having to press Alt, go to the Ease of Access center in the control panel and check "underline keyboard shortcuts and access keys".
来源:https://stackoverflow.com/questions/3056008/wpf-underline-a-letter-in-a-label-element