ערוך

שתף באמצעות


Label.Target Property

Definition

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

public:
 property System::Windows::UIElement ^ Target { System::Windows::UIElement ^ get(); void set(System::Windows::UIElement ^ value); };
public System.Windows.UIElement Target { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.NameReferenceConverter))]
public System.Windows.UIElement Target { get; set; }
member this.Target : System.Windows.UIElement with get, set
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.NameReferenceConverter))>]
member this.Target : System.Windows.UIElement with get, set
Public Property Target As UIElement

Property Value

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

Attributes

Examples

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>

Remarks

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.

Dependency Property Information

Identifier field TargetProperty
Metadata properties set to true None

XAML Attribute Usage

<Label Target=" nameOfExistingElement"/>  

XAML Property Element Usage

XAML Values

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

Applies to

See also