Skip to end of metadata
Go to start of metadata

Remarks

You can specify predefined styles that can be applied to all elements in FlowDocument, using FlowDocumentStyle collection. In FlowDocumentStyle, you can specify the fundamental element formatting, such as background, foreground, font-related properties, and border. Each FlowDocumentStyle should have a name, which will be referred from the element.

AXML

Working with BorderBrush Property, BorderStyle Property and BorderThickness Property

You can specify border formatting in Block elements. To specify global configuration for border, you can use BorderThickness, BorderBrush, and BorderStyle properties. BorderThickness property determines the border thickness of the element. BorderBrush property determines the Brush used to render the border.

BorderStyle property determines the line style of the border. Several predefined border style options are Single, Dot, DashDot, DashDotDot, DashLargeGap, and DashSmallGap.

XAML

Working with Borders Property

You can simplify the above configuration and use only one property, Borders, to specify the border configuration globally or individually. Borders property accepts comma and semicolon separated string. The pattern is [border width],[border line style],[border brush]. For example: Borders="1,Single,#FF000000" will set the border configuration to 1 pixel width, Single border line style, and black color brush. Note that the pattern cannot be swapped and you must use hexadecimal format to determine the border brush.

XAML

To use Borders property for individual border side configuration, repeat the pattern and separate them with semicolon. If there are two border definitions separated by semicolon, the first one will be applied to the left and right borders, and the second one will be applied to the top and bottom borders. If there are four border definitions separated by semicolon, the first one will be applied to the left border, the second one to the top border, the third one to the right border, and the last one to the bottom border. For example: Border="1,Single,#FF000000;2,Dot,#FFFF0000" will set the 1 pixel width, Single border line style, and black color brush to the left and right border, and 2 pixel width, Dot border line style, and red color brush to the top and bottom border.

XAML

Working with BottomBorderBrush Property, BottomBorderStyle Property, LeftBorderBrush Property, LeftBorderStyle Property, RightBorderBrush Property, RightBorderStyle Property, TopBorderBrush Property and TopBorderStyle Property

Besides global formatting, you can specify border thickness, brush, and style in each side of the border. For the left side of the border, you can use LeftBorderBrush and LeftBorderStyle properties. For the top side of the border, you can use TopBorderBrush and TopBorderStyle properties. For the right side of the border, you can use RightBorderBrush and RightBorderStyle properties. For the bottom side of the border, you can use BottomBorderBrush and BottomBorderStyle properties. BorderThickness uses Thickness-typed value, so you can specify the thickness of each side easily. Note that the individual border configuration will override the global border configuration.

XAML

Working with CornerRadius Property

You can set the element to use round corner border. Simply set CornerRadius property to a double value.

XAML

Definition

public class FlowDocumentStyle : DependencyObject

Summary

The following table summarizes the members exposed in this class.

Public Constructors

FlowDocumentStyle Constructor()Initializes a new instance of the FlowDocumentStyle class.

Public Properties

BackgroundGets or sets the Brush used to fill the background of the content area.
BorderBrushGets or sets a Brush to use when painting the element's border.
Borders 
BorderStyleGets or sets the border style used when painting the element's border.
BorderThicknessGets or sets the border thickness of the element.
BottomBorderBrushGets or sets a Brush to use when painting the element's bottom border.
BottomBorderStyleGets or sets the border style used when painting the element's bottom border.
CornerRadiusGets or sets the corner radius applied to the element's border.
FontFamilyGets or sets the preferred top-level font family for the content of the element.
FontSizeGets or sets the font size for the content of the element.
FontStretchGets or sets the font-stretching characteristics for the content of the element.
FontStyleGets or sets the font style for the content of the element.
FontWeightGets or sets the top-level font weight for the content of the element.
ForegroundGets or sets the Brush to apply to the content of the element.
LeftBorderBrushGets or sets a Brush to use when painting the element's left border.
LeftBorderStyleGets or sets the border style used when painting the element's left border.
NameGets or sets the style name that will be used as reference in the element.
RightBorderBrushGets or sets a Brush to use when painting the element's right border.
RightBorderStyleGets or sets the border style used when painting the element's right border.
TextDecorationsGets or sets the text decoration applied to the element.
TopBorderBrushGets or sets a Brush to use when painting the element's top border.
TopBorderStyleGets or sets the border style used when painting the element's top border.

Fields

BackgroundPropertyIdentifies the Background dependency property.
BorderBrushPropertyIdentifies the BorderBrush dependency property.
BordersPropertyIdentifies the Borders dependency property.
BorderStylePropertyIdentifies the BorderStyle dependency property.
BorderThicknessPropertyIdentifies the BorderThickness dependency property.
BottomBorderBrushPropertyIdentifies the BottomBorderBrush dependency property.
BottomBorderStylePropertyIdentifies the BottomBorderStyle dependency property.
CornerRadiusPropertyIdentifies the CornerRadius dependency property.
FontFamilyPropertyIdentifies the FontFamily dependency property.
FontSizePropertyIdentifies the FontSize dependency property.
FontStretchPropertyIdentifies the FontStretch dependency property.
FontStylePropertyIdentifies the FontStyle dependency property.
FontWeightPropertyIdentifies the FontWeight dependency property.
ForegroundPropertyIdentifies the Foreground dependency property.
LeftBorderBrushPropertyIdentifies the LeftBorderBrush dependency property.
LeftBorderStylePropertyIdentifies the LeftBorderStyle dependency property.
NamePropertyIdentifies the Name dependency property.
RightBorderBrushPropertyIdentifies the RightBorderBrush dependency property.
RightBorderStylePropertyIdentifies the RightBorderStyle dependency property.
TextDecorationsPropertyIdentifies the TextDecorations dependency property.
TopBorderBrushPropertyIdentifies the TopBorderBrush dependency property.
TopBorderStylePropertyIdentifies the TopBorderStyle dependency property.

Public Constructors

public FlowDocumentStyle()

 

Public Properties

public Brush Background { get; set; }

Gets or sets the Brush used to fill the background of the content area.

public Brush BorderBrush { get; set; }

Gets or sets a Brush to use when painting the element's border.

public BorderStyle Borders { get; set; }

 

public BorderLineStyle BorderStyle { get; set; }

Gets or sets the border style used when painting the element's border.

public Thickness BorderThickness { get; set; }

Gets or sets the border thickness of the element.

public Brush BottomBorderBrush { get; set; }

Gets or sets a Brush to use when painting the element's bottom border.

public BorderLineStyle BottomBorderStyle { get; set; }

Gets or sets the border style used when painting the element's bottom border.

public CornerRadius CornerRadius { get; set; }

Gets or sets the corner radius applied to the element's border.

public FontFamily FontFamily { get; set; }

Gets or sets the preferred top-level font family for the content of the element.

public double FontSize { get; set; }

Gets or sets the font size for the content of the element.

public FontStretch FontStretch { get; set; }

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

public FontStyle FontStyle { get; set; }

Gets or sets the font style for the content of the element.

public FontWeight FontWeight { get; set; }

Gets or sets the top-level font weight for the content of the element.

public Brush Foreground { get; set; }

Gets or sets the Brush to apply to the content of the element.

public Brush LeftBorderBrush { get; set; }

Gets or sets a Brush to use when painting the element's left border.

public BorderLineStyle LeftBorderStyle { get; set; }

Gets or sets the border style used when painting the element's left border.

public string Name { get; set; }

Gets or sets the style name that will be used as reference in the element.

public Brush RightBorderBrush { get; set; }

Gets or sets a Brush to use when painting the element's right border.

public BorderLineStyle RightBorderStyle { get; set; }

Gets or sets the border style used when painting the element's right border.

public TextDecorationCollection TextDecorations { get; set; }

Gets or sets the text decoration applied to the element.

public Brush TopBorderBrush { get; set; }

Gets or sets a Brush to use when painting the element's top border.

public BorderLineStyle TopBorderStyle { get; set; }

Gets or sets the border style used when painting the element's top border.

Fields

public static readonly DependencyProperty BackgroundProperty

Identifies the Background dependency property.

public static readonly DependencyProperty BorderBrushProperty

Identifies the BorderBrush dependency property.

public static readonly DependencyProperty BordersProperty

Identifies the Borders dependency property.

public static readonly DependencyProperty BorderStyleProperty

Identifies the BorderStyle dependency property.

public static readonly DependencyProperty BorderThicknessProperty

Identifies the BorderThickness dependency property.

public static readonly DependencyProperty BottomBorderBrushProperty

Identifies the BottomBorderBrush dependency property.

public static readonly DependencyProperty BottomBorderStyleProperty

Identifies the BottomBorderStyle dependency property.

public static readonly DependencyProperty CornerRadiusProperty

Identifies the CornerRadius dependency property.

public static readonly DependencyProperty FontFamilyProperty

Identifies the FontFamily dependency property.

public static readonly DependencyProperty FontSizeProperty

Identifies the FontSize dependency property.

public static readonly DependencyProperty FontStretchProperty

Identifies the FontStretch dependency property.

public static readonly DependencyProperty FontStyleProperty

Identifies the FontStyle dependency property.

public static readonly DependencyProperty FontWeightProperty

Identifies the FontWeight dependency property.

public static readonly DependencyProperty ForegroundProperty

Identifies the Foreground dependency property.

public static readonly DependencyProperty LeftBorderBrushProperty

Identifies the LeftBorderBrush dependency property.

public static readonly DependencyProperty LeftBorderStyleProperty

Identifies the LeftBorderStyle dependency property.

public static readonly DependencyProperty NameProperty

Identifies the Name dependency property.

public static readonly DependencyProperty RightBorderBrushProperty

Identifies the RightBorderBrush dependency property.

public static readonly DependencyProperty RightBorderStyleProperty

Identifies the RightBorderStyle dependency property.

public static readonly DependencyProperty TextDecorationsProperty

Identifies the TextDecorations dependency property.

public static readonly DependencyProperty TopBorderBrushProperty

Identifies the TopBorderBrush dependency property.

public static readonly DependencyProperty TopBorderStyleProperty

Identifies the TopBorderStyle dependency property.

  • No labels