Udostępnij za pośrednictwem


TextElement.FontFamily Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the preferred top-level font family for the content of the element.

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

Syntax

'Declaration
Public Property FontFamily As FontFamily
public FontFamily FontFamily { get; set; }
<textElement FontFamily="fontFamily" />
-or-
<textElement FontFamily="fontFamilyName[,fallbackFontFamilyName]" />
-or-
<textElement FontFamily="fontURI#fontFamily" />

XAML Values

  • fontFamily
    A single font family name, for example "Verdana".

  • fontFamilyName[,fallbackFontFamilyName]
    A primary font family choice then one or more fallback font family choices, for example "Arial Unicode MS, Arial". See Remarks.

  • fontURI#fontFamily
    Used for non-default fonts. Specifies the resource location in the assembly for a font file, and a font family within that font. For information on this usage, see FontFamily. For more information on relative URIs for accessing font resources, see Resource Files.

Property Value

Type: System.Windows.Media.FontFamily
The preferred font family, or a primary preferred font family with one or more fallback font families. See FontFamily for default information.

Remarks

Dependency property identifier field: FontFamilyProperty

A font family is a set of typefaces that share the same family name, such as "Times New Roman", but that differ in features. These font family feature differences include font style, such as italic, and font weight, such as bold. For more information, including information on the XAML usage, see FontFamily. Restrictions apply when specifying a font file or a zip file containing font files. See Text and Fonts for details.

NoteNote:

As with most types of software, font files are licensed, rather than sold, and licenses that govern the use of fonts vary from vendor to vendor. As a developer it is your responsibility to ensure that you have the required license rights for any font you embed within a document or application, or otherwise redistribute.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

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