Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FlowDocument.FontWeight Property

 

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

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

public FontWeight FontWeight { get; set; }

Property Value

Type: System.Windows.FontWeight

A member of the FontWeights class that specifies the desired font weight. The default is determined by the SystemFonts.MessageFontWeight value.

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

The following example shows how to set the FontWeight 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 FontWeight property programmatically.

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;

.NET Framework
Available since 3.0
Return to top
Show:
© 2017 Microsoft