Xamarin.Forms.Core
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.View
Xamarin.Forms.ContentProperty("Text")
Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._LabelRenderer))
A that displays text.
A Label is used to display single-line text elements as well as multi-line blocks of text.
The following example, adapted from the default Xamarin Forms solution, shows a basic use:
The FormsGallery sample, which can be found on the Sample Applications page, has a LabelDemoPage.cs file. This file contains a longer and more complete example.
XAML for Xamarin.Forms supports the following properties for the class:
Property
Value
-
Font
Deprecated. Use FontAttributes, FontFamily, and FontSize, instead. A string of the format [name],[attributes],[size]. The font specification may contain multiple attributes, e.g. Georgia, Bold, Italic, 42.
-
FontAttributes
Bold, Bold,Italic, or None.
-
FontFamily
A font family, such as sans-serif or monospace.
-
FontSize
A named size, such as Large, or an integer that represents the size in device units.
-
LineBreakMode
A string that corresponds to a enumeration value.
-
Text
The text that will appear on the label.
-
TextColor
A color specification, with or without the prefix, "Color". For example, "Color.Red" and "Red" both specify the color red.
-
HorizontalTextAlignment
Center, End, or Start, to indicate the horizontal placement of the label text.
-
VerticalTextAlignment
Center, End, or Start, to indicate the vertical placement of the label text.
Constructor
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Initializes a new instance of the Label class.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Obsolete("Please use the Font attributes which are on the class itself. Obsoleted in v1.3.0")
Xamarin.Forms.Font
Gets or sets the Font for the Label. This is a bindable property.
The value for the Label. The default is , which represents the default font on the platform.
Property
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.FontAttributes
Gets a value that indicates whether the font for the label is bold, italic, or neither.
To be added.
To be added.
Field
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the FontAttributes property.
To be added.
Property
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.String
Gets the font family to which the font for the label belongs.
To be added.
To be added.
Field
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the FontFamily property.
To be added.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the Font bindable property.
Property
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.TypeConverter(typeof(Xamarin.Forms.FontSizeConverter))
System.Double
Gets the size of the font for the label.
To be added.
To be added.
Field
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the FontSize property.
To be added.
Property
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.FormattedString
Gets or sets the formatted text for the Label. This is a bindable property.
The value to be displayed inside of the Label. This is a bindable property.
Setting FromattedText to a non-null value will set the Text property to null.
Field
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the FormattedText property.
To be added.
Property
1.5.0.0
2.0.0.0
Xamarin.Forms.TextAlignment
Gets or sets the horizontal alignement of the Text property. This is a bindable property.
To be added.
To be added.
Field
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Identifies the HorizontalTextAlignment bindable property
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.LineBreakMode
Gets or sets the LineBreakMode for the Label. This is a bindable property.
The value for the Label. The default is
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the LineBreakMode bindable property.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.String
Gets or sets the text for the Label. This is a bindable property.
The value to be displayed inside of the Label.
Setting Text to a non-null value will set the FormattedText property to null.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.Color
Gets or sets the for the text of this Label. This is a bindable property.
The value.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the TextColor bindable property.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Backing store for the Text bindable property.
Property
1.5.0.0
2.0.0.0
Xamarin.Forms.TextAlignment
Gets or sets the vertical alignement of the Text property. This is a bindable property.
To be added.
To be added.
Field
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Identifies the VerticalTextAlignment bindable property.
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Obsolete("XAlign is obsolete. Please use HorizontalTextAlignment instead.")
Xamarin.Forms.TextAlignment
Gets or sets the horizontal alignment for the Text inside of the Label bound.
The value. The default is , i.e. the text is left-aligned.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Obsolete("XAlignProperty is obsolete. Please use HorizontalTextAlignmentProperty instead.")
Xamarin.Forms.BindableProperty
Backing store for the XAlign bindable property.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Obsolete("YAlign is obsolete. Please use VerticalTextAlignment instead.")
Xamarin.Forms.TextAlignment
Gets or sets the vertical alignment for the Text inside of the Label bound.
The value. The default is , i.e. the text is top-aligned.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Obsolete("YAlignProperty is obsolete. Please use VerticalTextAlignmentProperty instead.")
Xamarin.Forms.BindableProperty
Backing store for the YAlign bindable property.