Skip to end of metadata
Go to start of metadata

Remarks

List is used to create a bulleted or numeric list. List element can only contain ListItem element collection.

Set the MarkerStyle property to a TextMarkerStyle enumeration value to determine the style of the list. The built-in marker styles provided in FlowDocument are Disc, Circle, Square, Box, LowerRoman, UpperRoman, LowerLatin, UpperLatin, Decimal, and None.

XAML

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

Working with LineSpacing Property and LineSpacingType Property

You can use LineSpacingType and LineSpacing properties to specify spacing between lines in FlowDocument elements. The following are the options of LineSpacingType property:

  • Single
    When this option is selected, there will be no spacing between the lines.
  • OneAndHalfLines
    When this option is selected, the spacing between lines will be half of the line height.
  • Double
    When this option is selected, the spacing between lines will be the same as the line height.
  • AtLeast
    When this option is selected, the line height will at least be the same with the value of LineSpacing property. For example, if LineSpacing is set to 25, the line height will at least be 25 pixel. The line height can be a larger value than 25 pixel.
  • Exactly
    When this option is selected, the line height will exactly be the same as the value of LineSpacing property. For example, if the LineSpacing is set to 25, the line height will be exactly 25 pixel. If the line height is larger than 25 pixel, the content will be clipped.
  • Multiple
    When this option is selected, the line height will use the value of LineSpacing property multiplied by 2. For example, if the LineSpacing is set to 25, the line height will be 50 pixel.

Definition

public class ListItem : TextElement

Summary

The following table summarizes the members exposed in this class.

Public Constructors

ListItem Constructor()Initializes a new instance of the ListItem class.
ListItem Constructor(Block)Initializes a new instance of the ListItem class.

Public Properties

BlocksGets or sets the top-level Block element collection the list item.
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.
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.
LineSpacingGets or sets the custom line spacing of the element.
LineSpacingTypeGets or sets the line spacing type of the element.
MarginGets or sets the margin thickness for the element.
PaddingGets or sets the padding thickness for 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.
TextAlignmentGets or sets the horizontal alignment of text content.
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

BlocksPropertyIdentifies the Blocks 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.
LeftBorderBrushPropertyIdentifies the LeftBorderBrush dependency property.
LeftBorderStylePropertyIdentifies the LeftBorderStyle dependency property.
LineSpacingPropertyIdentifies the LineSpacing dependency property.
LineSpacingTypePropertyIdentifies the LineSpacingType dependency property.
MarginPropertyIdentifies the Margin dependency property.
PaddingPropertyIdentifies the Padding dependency property.
RightBorderBrushPropertyIdentifies the RightBorderBrush dependency property.
RightBorderStylePropertyIdentifies the RightBorderStyle dependency property.
TextAlignmentPropertyIdentifies the TextAlignment dependency property.
TopBorderBrushPropertyIdentifies the TopBorderBrush dependency property.
TopBorderStylePropertyIdentifies the TopBorderStyle dependency property.

Public Constructors

public ListItem()

Initializes a new instance of the ListItem class.

public ListItem(Block block)

Initializes a new instance of the ListItem class.

Parameters

block 

 

Public Properties

public BlockCollection Blocks { get; set; }

Gets or sets the top-level Block element collection the list item.

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 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 double LineSpacing { get; set; }

Gets or sets the custom line spacing of the element.

public LineSpacingType LineSpacingType { get; set; }

Gets or sets the line spacing type of the element.

public Thickness Margin { get; set; }

Gets or sets the margin thickness for the element.

public Thickness Padding { get; set; }

Gets or sets the padding thickness for 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 TextAlignment TextAlignment { get; set; }

Gets or sets the horizontal alignment of text content.

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 BlocksProperty

Identifies the Blocks 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 LeftBorderBrushProperty

Identifies the LeftBorderBrush dependency property.

public static readonly DependencyProperty LeftBorderStyleProperty

Identifies the LeftBorderStyle dependency property.

public static readonly DependencyProperty LineSpacingProperty

Identifies the LineSpacing dependency property.

public static readonly DependencyProperty LineSpacingTypeProperty

Identifies the LineSpacingType dependency property.

public static readonly DependencyProperty MarginProperty

Identifies the Margin dependency property.

public static readonly DependencyProperty PaddingProperty

Identifies the Padding 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 TextAlignmentProperty

Identifies the TextAlignment dependency property.

public static readonly DependencyProperty TopBorderBrushProperty

Identifies the TopBorderBrush dependency property.

public static readonly DependencyProperty TopBorderStyleProperty

Identifies the TopBorderStyle dependency property.

  • No labels