Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GroupBox.OnAccessKey Method

Responds when the AccessKey for the GroupBox is pressed.

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

protected override void OnAccessKey(
	AccessKeyEventArgs e
)

Parameters

e
Type: System.Windows.Input.AccessKeyEventArgs

The event information.

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 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>

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft