TextElement.FontSize Property

May 11, 2014

Gets or sets the font size for the content of the element.

Namespace:  System.Windows.Documents
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public double FontSize { get; set; }
<textElement FontSize="double" ... /> 

Property Value

Type: System.Double
The desired font size in pixels. The default is 11 pixels.

Dependency property identifier field: FontSizeProperty

The XAML values for FontSize can include a unit qualifier such as "pt" or "px". However, these unit qualifiers are not supported in Windows Phone. You must specify a numeric value only, which is always interpreted as pixels. If you are importing XAML UI definitions from WPF, you must adjust the FontSize attribute values to strip the unit qualifiers, including "px" (this might also involve converting the previous units to pixel values). Otherwise, parsing the XAML will fail.

FontSize does not affect the height of the line break. Only the FontSize set on the text runs themselves has any effect. The line height for a LineBreak is influenced by the surrounding runs, but multiple line breaks in succession use the default 11 pixel height. (LineStackingStrategy can also influence this spacing.)

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

© 2014 Microsoft