FontFamily

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

Gets or sets the preferred font family for the content in this element.

<object FontFamily="fontFamily"  .../>
value = object.FontFamily
object.FontFamily = value

Property Value

Type: string

A string that specifies the preferred font family. The string can include one or more fallback font families.

This property is read/write. The default value is "Portable User Interface", which is an alias for the font family value of "Lucida Sans Unicode, Lucida Grande" for non-East Asian locales.

FontFamily Grammar

The following shows the format for specifying font families.

fontFamilyName[,fallbackFontFamilyName]*

fontFamilyName

A string that specifies the preferred font family.

fallbackFontFamilyName

A string that specifies the fallback font family. More than one fallback can be specified. Commas separate each font family. To avoid ambiguity, if a font family contains a comma (,), each single comma (,) in the font family must be replaced with a double comma (,,).

Silverlight permits a fixed list of fonts that are valid for reference as local fonts, without requiring the font to be downloaded. For the list of fonts, see Text and Fonts.

Remarks

You can use the SetFontSource method to add downloaded font content to the existing collection of type faces for Silverlight text elements. The downloaded content can either be an individual font file or packaged content, such as a compressed file, that contains one or more font files.

NoteNote:

As with most types of software, font files are licensed, rather than sold. 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 that you embed within a document or application, or otherwise redistribute.

The "Applies To" section of this topic lists LineBreak, because it does exist in the object model and you can get and set it. However, all LineBreak properties are ignored for rendering purposes.

Applies To

LineBreak

Run

PasswordBox (Silverlight 2)

TextBlock

TextBox (Silverlight 2)