FlowDocument.FontStyle Property

 

Gets or sets the top-level font style for the FlowDocument.

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

Public Property FontStyle As FontStyle

Property Value

Type: System.Windows.FontStyle

A member of the FontStyles class that specifies the desired font style. The default is determined by the SystemFonts.MessageFontStyle value.

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

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

<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 FontStyle property programmatically.

Dim flowDoc As 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

.NET Framework
Available since 3.0
Return to top
Show: