FlowDocument.FontStretch Property

Definition

Gets or sets the top-level font-stretching characteristics for the FlowDocument.

C#
public System.Windows.FontStretch FontStretch { get; set; }

Property Value

A member of the FontStretch class that specifies the desired font-stretching characteristics to use. The default is Normal.

Examples

The following example shows how to set the FontStretch attribute of a FlowDocument element.

XAML
<FlowDocumentReader>
  <FlowDocument
    FontFamily="Century Gothic"
    FontSize="12"
    FontStretch="UltraExpanded"
    FontStyle="Italic"
    FontWeight="UltraBold"
  >
    <Paragraph>
      Any font settings on this paragraph would override the font settings
      for the FlowDocument.
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

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

C#
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
// Set the desired column gap to 10 device independend pixels.
flowDoc.FontFamily = new FontFamily("Century Gothic");
flowDoc.FontSize = 12.0;
flowDoc.FontStretch = FontStretches.UltraExpanded;
flowDoc.FontStyle = FontStyles.Italic;
flowDoc.FontWeight = FontWeights.UltraBold;

Remarks

Any FontStretch settings on child elements override this top-level setting.

Dependency Property Information

Item Value
Identifier field FontStretchProperty
Metadata properties set to true AffectsMeasure, AffectsRender, Inherits

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10