Label::Target Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the element that receives focus when the user presses the label's access key.

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

public:
[TypeConverterAttribute((NameReferenceConverter^::typeid))]
property UIElement^ Target {
	UIElement^ get();
	void set(UIElement^ value);
}

Property Value

Type: System.Windows::UIElement^

The UIElement that receives focus when the user presses the access key. The default is null.

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.

Identifier field

TargetProperty

Metadata properties set to true

None

<Label Target="nameOfExistingElement"/>

nameOfExistingElement

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

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

.NET Framework
Available since 3.0
Silverlight
Available since 3.0
Return to top
Show: