This documentation is archived and is not being maintained.

Label.Target Property

Gets or sets the element that receives focus when the user presses the label's access key. This is a dependency property.

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

public UIElement Target { get; set; }
    <UIElement .../>
<Label Target="{Binding ElementName=SomeName}"/>

XAML Values


The name of UIElement that receives focus when the access key is pressed.

Property Value

Type: System.Windows.UIElement
The UIElement that receives focus when the user presses the access key. The default is null.

Identifier field


Metadata properties set to true


You can provide keyboard shortcuts to elements that don't support access keys by giving a Label an access key and setting this property. Assign an access key to a label by placing an underscore immediately before the character that acts as the access key. An access key can be specified in the Content property or by setting Content to an AccessText object.

You cannot use this property to define a UIElement. For example, the following compiles but is not functional: <object.Target><UIElement../></object.Target>. This property provides a reference to an element that is already defined in your application.

The following example shows how to set the Target property of a Label.

<TextBox Name="tb" Width="50"/>
<Label Target="{Binding ElementName=tb}">_File</Label>

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0