#246 – Use FlowDocument Control to Host Entire Documents

The FlowDocument control provides richer functionality than Label and TextBlock for displaying text.

A FlowDocument contains a collection of blocks, each of which is a separate paragraph, list, section or table.  Below is a simple example.

		<FlowDocument FontFamily="Cambria" FontSize="16">
			<Paragraph FontFamily="Arial" FontSize="14">
				Excerpt from <Italic>White Fang</Italic>, by <Bold>Jack London</Bold>
			</Paragraph>

			<Paragraph>
				A second cry arose, piercing the silence with needle-like shrillness.  Both men located the sound.
				It was to the rear, somewhere in the snow expanse they had just traversed.  A third and answering
				cry arose, also to the rear and to the left of the second cry.
			</Paragraph>

			<Paragraph>
				“They’re after us, Bill,” said the man at the front.
			</Paragraph>

			<Paragraph>
				His voice sounded hoarse and unreal, and he had spoken with apparent effort.
			</Paragraph>
		</FlowDocument>

Note that the content in the document automatically flows to fit the available space.

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: