#303 – Define an Access Key for a Control Using an Underline

You define an access key for a control by including an underscore ‘_’ character immediately before the desired access key character in the control’s caption or label.  You can then use that character, in combination with the ALT key, to activate the control or give it focus.

Here are some examples:

        <Button Content="_Eggs" Width="100" Margin="10" Click="Button_Click"/>
        <CheckBox Content="_I'm hungry now" Margin="10" HorizontalAlignment="Center"/>
        <RadioButton Content="Pick _Me" Margin="10" HorizontalAlignment="Center"/>

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #303 – Define an Access Key for a Control Using an Underline

  1. MrBejla says:

    And how can I define an access key, if the content comes from a (resource) .resx file (something like Content=”{Binding BtnStart}”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: