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.
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.
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.
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.
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.
Working with CornerRadius Property
You can set the element to use round corner border. Simply set CornerRadius property to a double value.
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
Background | Gets or sets the Brush used to fill the background of the content area. |
BorderBrush | Gets or sets a Brush to use when painting the element's border. |
Borders | |
BorderStyle | Gets or sets the border style used when painting the element's border. |
BorderThickness | Gets or sets the border thickness of the element. |
BottomBorderBrush | Gets or sets a Brush to use when painting the element's bottom border. |
BottomBorderStyle | Gets or sets the border style used when painting the element's bottom border. |
CornerRadius | Gets or sets the corner radius applied to the element's border. |
FontFamily | Gets or sets the preferred top-level font family for the content of the element. |
FontSize | Gets or sets the font size for the content of the element. |
FontStretch | Gets or sets the font-stretching characteristics for the content of the element. |
FontStyle | Gets or sets the font style for the content of the element. |
FontWeight | Gets or sets the top-level font weight for the content of the element. |
Foreground | Gets or sets the Brush to apply to the content of the element. |
LeftBorderBrush | Gets or sets a Brush to use when painting the element's left border. |
LeftBorderStyle | Gets or sets the border style used when painting the element's left border. |
Name | Gets or sets the style name that will be used as reference in the element. |
RightBorderBrush | Gets or sets a Brush to use when painting the element's right border. |
RightBorderStyle | Gets or sets the border style used when painting the element's right border. |
TextDecorations | Gets or sets the text decoration applied to the element. |
TopBorderBrush | Gets or sets a Brush to use when painting the element's top border. |
TopBorderStyle | Gets or sets the border style used when painting the element's top border. |
Fields
BackgroundProperty | Identifies the Background dependency property. |
BorderBrushProperty | Identifies the BorderBrush dependency property. |
BordersProperty | Identifies the Borders dependency property. |
BorderStyleProperty | Identifies the BorderStyle dependency property. |
BorderThicknessProperty | Identifies the BorderThickness dependency property. |
BottomBorderBrushProperty | Identifies the BottomBorderBrush dependency property. |
BottomBorderStyleProperty | Identifies the BottomBorderStyle dependency property. |
CornerRadiusProperty | Identifies the CornerRadius dependency property. |
FontFamilyProperty | Identifies the FontFamily dependency property. |
FontSizeProperty | Identifies the FontSize dependency property. |
FontStretchProperty | Identifies the FontStretch dependency property. |
FontStyleProperty | Identifies the FontStyle dependency property. |
FontWeightProperty | Identifies the FontWeight dependency property. |
ForegroundProperty | Identifies the Foreground dependency property. |
LeftBorderBrushProperty | Identifies the LeftBorderBrush dependency property. |
LeftBorderStyleProperty | Identifies the LeftBorderStyle dependency property. |
NameProperty | Identifies the Name dependency property. |
RightBorderBrushProperty | Identifies the RightBorderBrush dependency property. |
RightBorderStyleProperty | Identifies the RightBorderStyle dependency property. |
TextDecorationsProperty | Identifies the TextDecorations dependency property. |
TopBorderBrushProperty | Identifies the TopBorderBrush dependency property. |
TopBorderStyleProperty | Identifies 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.