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)
XML Namespace:

public UIElement Target { get; set; }
/** @property */
public UIElement get_Target ()

/** @property */
public void set_Target (UIElement value)

public function get Target () : UIElement

public function set Target (value : UIElement)

    <UIElement .../>
<Label Target="{Binding ElementName=someName}"/>

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

Property Value

The UIElement that receives focus when the user presses the access key. The default value is a null reference (Nothing in Visual Basic).

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