Export (0) Print
Expand All

RadioButton.OnAccessKey Method

Called when the AccessKey for a radio button is invoked.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)

protected override void OnAccessKey (
	AccessKeyEventArgs e
)
protected void OnAccessKey (
	AccessKeyEventArgs e
)
protected override function OnAccessKey (
	e : AccessKeyEventArgs
)
You cannot use methods in XAML.

Parameters

e

Provides data for AccessKeyEventArgs.

This example shows how to create a control that has an access key and supports text wrapping. The example uses a Label control to illustrate these concepts.

Add Text Wrapping to Your Label

The Label control does not support text wrapping. If you need a label that wraps across multiple lines, you can nest another element that does support text wrapping and put the element inside the label. The following example shows how to use a TextBlock to make a label that wraps several lines of text.

<Label Width="200" HorizontalAlignment="Left">
  <TextBlock TextWrapping="WrapWithOverflow">
    A long piece of text that requires text wrapping
    goes here.
  </TextBlock>
</Label>

Add an Access Key and Text Wrapping to Your Label

If you need a Label that has an access key (mnemonic), use the AccessText element that is inside the Label.

Controls such as Label, Button, RadioButton, CheckBox, MenuItem, TabItem, Expander, and GroupBox have default control templates. These templates contain a ContentPresenter. One of the properties that you can set on the ContentPresenter is RecognizesAccessKey="true", which you can use to specify an access key for the control.

The following example shows how to create a Label that has an access key and supports text wrapping. To enable text wrapping, the example sets the TextWrapping property and it uses an underline character to specify the access key. (The character that immediately follows the underline character is the access key.)

<TextBox Name="textBox1" Width="50" Height="20"/>
<Label Width="200" HorizontalAlignment="Left"
       Target="{Binding ElementName=textBox1}">
  <AccessText TextWrapping="WrapWithOverflow">
    _Another long piece of text that requires text wrapping
    goes here.
  </AccessText>
</Label>

For the complete sample, see Label Sample.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft