Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

TextElement.FontStretch Property

Gets or sets the font-stretching characteristics for the content of the element.

Namespace:  System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
member FontStretch : FontStretch with get, set
<object FontStretch="FontStretch" .../>

Property Value

Type: System.Windows.FontStretch
A FontStretch structure that specifies the desired font-stretching characteristics to use. The default is FontStretches.Normal.

This dependency property also has an attached property usage. In XAML, the usage is <object TextElement.FontStretch="value".../>, where object is an object element (typically a flow element) contained within a TextElement, and value is one of the string-format property names of the FontStretch class. In code, the attached property usage is supported by the GetFontStretch and SetFontStretch methods. The attached property usage is not common, because most elements that can be contained in a TextElement support an analogous nonattached FontStretch property, which the content host uses for rendering.

The following example shows how to set the FontStretch attribute, using Paragraph as the example element.

<Paragraph
  FontFamily="Century Gothic, Courier New"  
  FontSize="16pt"
  FontStretch="UltraExpanded"
  FontStyle="Italic"
  FontWeight="DemiBold"
>
  <Run>
    This text will use the Century Gothic font (if available), with fallback to Courier New.  It 
    will render with a font size of 16 points in ultra-expanded demi-bold italic.
  </Run>
</Paragraph>

The following figure shows how the preceding example renders.

Screenshot: Text with text properties set

The following example shows how to set the FontStretch property programmatically.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.