Label Class
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
This class provides both functional and visual support for access keys (also known as mnemonics). It is frequently used to enable quick keyboard access to controls such as a TextBox. To assign a Label to a Control, set the Target property to the control that should get focus when the user presses the access key. Setting the target also causes Microsoft UI Automation to use the text of the label as the name of the targeted control. For more information, see Accessibility.
Content Model: Label is a ContentControl. For more information on the content model for Label, see ContentControl Content Model.
The following example shows how to create a Label that uses a binding to set the target.
<TextBox Name="tb" Width="50"/> <Label Target="{Binding ElementName=tb}">_File</Label>
The following example shows how to create a Label that has an access key and supports text wrapping.
<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>
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.