Partilhar via


TextBlock.FontStretch Property

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

Gets or sets the font stretch for the text content in this element.

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

Syntax

'Declaration
Public Property FontStretch As FontStretch
public FontStretch FontStretch { get; set; }
<TextBlock FontStretch="fontStretchesValue"/>

XAML Values

  • fontStretchesValue
    A FontStretches property name, such as Condensed, Normal, or Expanded. See Remarks regarding font fallback issues.

Property Value

Type: System.Windows.FontStretch
The requested font stretch, which is a FontStretch that is obtained from one of the FontStretches property values. The default is Normal.

Remarks

Dependency property identifier field: FontStretchProperty

A font stretch describes the degree to which a font form is stretched from its normal aspect ratio. (The aspect ratio is the original width to height ratio specified for the glyphs in the font.) This property can select only from fonts that exist in a font family and the corresponding glyphs. Setting a FontStretch value that does not inherently exist in a font family does not cause programmatic stretching of glyphs. Font fallback behavior does not change the property value, the property will remain as the value you set it to despite whatever visual behavior results due to font fallback.

The FontStretches properties correspond to the usWidthClass definition in the OpenType specification. The usWidthClass represents an integer value between 1 and 9. Lower numeric values indicate narrower widths, and higher values indicate wider widths. For more information about usWidthClass, see the enumeration table in FontStretches.

FontStretch settings for Run child elements override the settings on the containing TextBlock.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

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