Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

TextElement.FontSize Property

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

Namespace:  System.Windows.Documents
Assembly:  System.Windows (in System.Windows.dll)
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

In Windows Presentation Foundation (WPF), the XAML values for FontSize can include a unit qualifier such as "pt" or "px". However, these unit qualifiers are not supported in Silverlight. 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.)

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.