#254 – Types of Containers for Hosting a FlowDocument

There are four different controls that you can use to host a FlowDocument:

  • FlowDocumentReader – Reader with support for multiple columns, paging, find and zooming
  • FlowDocumentPageViewer – Reader with support for multiple columns, paging and zooming
  • RichTextBox – Content displayed in an editable format
  • FlowDocumentScrollViewer – Content displayed¬† with a vertical scrollbar

Here are screenshots of each of the containers:

Advertisements

#252 – FlowDocument Flows its Content Automatically

A FlowDocument automatically flows its content to fit its current size.  In the example below, we include a FlowDocument in a FlowDocumentScrollViewer:

	<FlowDocumentScrollViewer>
		<FlowDocument FontFamily="Cambria" FontSize="14">
			<Paragraph>
There was no possibility of taking a walk that day.  We had been wandering, indeed, in the leafless shrubbery an hour in the morning; but since dinner (Mrs. Reed, when there was no company, dined early) the cold winter wind had brought with it clouds so sombre, and a rain so penetrating, that further out-door exercise was now out of the question.
			</Paragraph>
			<Paragraph>
I was glad of it: I never liked long walks, .. etc. etc.

At runtime, the content will flow/wrap to fit the current window:

Also note that the text is automatically justified–both the left and right sides of the paragraph are lined up.