#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>

Advertisement