#250 – Including a Section Block in a FlowDocument

A Section is a type of Block that you can include in a FlowDocument.  A Section acts as a container for other blocks.  You can then set various properties on the block and have those properties apply to all elements within the block.

Here’s a short example:

	<FlowDocument FontFamily="Cambria" FontSize="14">
		<Paragraph>Act I - George and Martha return from a faculty party, but Martha soon informs George that she has invited over guests.</Paragraph>
		<Paragraph>Act II - The wives rejoin the men and Martha begins to describe her husband's only novel.</Paragraph>
		<Section Background="LightGreen" Margin="10" FontFamily="Arial" FontSize="12" FontStyle="Italic">
			<Paragraph>Novel is embarrassingly autobiographical.</Paragraph>
			<Paragraph>George speaks of Martha's hysterical pregnancy.</Paragraph>
		</Section>
	</FlowDocument>

#247 – Types of Blocks that You Can Use in a FlowDocument

There are five different types of blocks that you can include in a FlowDocument.  A block can be one of the following:

  • Paragraph – A paragraph of text
  • List – A list of text items, typically displayed with a bullet character
  • Table – A table, with rows and columns
  • Section – A section of the document that can, in turn, contain other blocks
  • BlockUIContainer – A placeholder that allows inserting any UIElement into the document