Reputation: 173
I'm currently designing my Silverlight Application interface in Expression Blend 4. I'd like the user to be able to press the Alt key and see underlined characters on buttons to provide hotkey functionality. This used to be done in VB by adding an "&" character before the letter you wanted underlined (eg. "&Save"). In XAML, my understanding is that you do it with an underscore ("_"). However, when I use the underscore, the underscore character is literally appearing in my button's content. ("_Save" shows up on the button). What am I doing incorrectly?
Here is the button's XAML:
<Button Content="_Save" Height="30" Foreground="DarkGray"/>
I'm sure I'm missing something simple, but I'm too new to this and just am not finding existing help. Thank you.
Upvotes: 1
Views: 810
Reputation: 14943
Will something like this do it for you?
<Button x:Name="Play" Margin="1,2"
ToolTipService.ToolTip="shortcut key: P"
AutomationProperties.AccessKey="P">
<TextBlock><Underline>P</Underline>lay</TextBlock>
</Button>
Upvotes: 3