FontSource Property

TextBlock.FontSource Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the font source that is applied to the text for rendering content.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

Public Property FontSource As FontSource

Property Value

Type: System.Windows.Documents.FontSource
The font source that is used to render content in the text box. The default is Nothing.

For the TextBlock element, Windows Phone selects the font from the following sources:

  • From supported local fonts.

  • From the fonts that are provided in a packaged file that is referenced in the FontFamily property.

  • From the zip or .ttf file passed as a stream to the FontSource property.

The font that is selected is the best match based on the values of the FontFamily, FontStretch, FontStyle, and FontWeight properties. It is important to specify all four of these font properties to make sure that an accurate and consistent font selection is made for the TextBlock.

If the FontSource property is set to Nothing, any assigned custom font is cleared and the TextBlock renders with the default font.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft