Skip to content

Label class

A control that displays text with access key support. Text containing an underscore prefix (e.g. “_Name”) will parse the character following the underscore as an access key, rendering it with an underline when Alt is pressed. Use Target to direct access key activation to another control. For plain text without access key parsing, use TextBlock instead.

Guide: C# Markup reference: Text

public class Label : Control
name description
Label() The default constructor.
Target { get; set; } Gets or sets the element that receives OnAccessKey when this label’s access key is activated; null lets the access key bubble up the parent chain.
Text { get; set; } Gets or sets the text; an underscore prefix marks the access key character (e.g. “_Name” registers Alt+N) and a double underscore is a literal underscore.
TextAlignment { get; set; } Gets or sets the horizontal text alignment.
TextTrimming { get; set; } Gets or sets the text trimming mode.
TextWrapping { get; set; } Gets or sets the text wrapping mode.
VerticalTextAlignment { get; set; } Gets or sets the vertical text alignment.
static readonly TextAlignmentProperty
static readonly TextProperty
static readonly TextTrimmingProperty
static readonly TextWrappingProperty
static readonly VerticalTextAlignmentProperty