TextBlock.FontFamily Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets or sets the preferred top-level font family for the text content in this element.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
<TextBlock FontFamily="fontFamily" /> -or- <TextBlock FontFamily="fontFamilyName[,fallbackFontFamilyName]" /> -or- <TextBlock FontFamily="fontURI#fontFamily" />
XAML Values
Property Value
Type: System.Windows.Media.FontFamilyA FontFamily object that specifies the preferred font family, or a primary preferred font family with one or more fallback font families. For information about defaults, see the FontFamily class topic.
| Exception | Condition |
|---|---|
| ArgumentNullException | FontFamily is Nothing. |
Dependency property identifier field: FontFamilyProperty
The default value is a FontFamily for "Portable User Interface", which represents a composite font that uses a number of fonts to implement the range of international languages that are supported by Windows Phone. This includes Lucida Sans Unicode and Lucida Grande for many Western writing systems, and many more for East Asian writing systems.
For more information, see FontFamily. For a complete list of supported fonts, see Text and fonts for Windows Phone. For information on how to specify a non-default FontFamily, where you distribute a font file as an assembly resource, see FontFamily.
Any FontFamily settings on Run child elements override the settings on the containing TextBlock.
Fallbacks for Fonts, as Specified in XAML
When multiple families are specified, the second and subsequent font families serve as fallback families to use if the primary font family is unavailable or not applicable. To specify multiple font families, use the following syntax:
fontFamilyName[,fallbackFontFamilyName]
In this syntax, fontFamilyName specifies the primary font, and fallbackFontFamilyName specifies an optional fallback. More than one fallback can be specified. Use commas to separate each font family string. To avoid ambiguity, if a font family contains a comma (",") in the name, each single comma in a font family reference must be replaced with a double comma (",,").
This property specifies a preference only. If the specified font family is not available, the TextBlock falls back silently to the "Portable User Interface" composite font.
Note: |
|---|
Most font files are licensed rather than sold, and licenses that govern the use of fonts vary from vendor to vendor. It is your responsibility to make sure that you have the required license rights for any font that you embed in a document or application, or that you otherwise redistribute. |
Note: