#256 – Use a FixedDocument to Display Content at Fixed Locations

Where FlowDocument allows displaying content that flows automatically from page to page, FixedDocument allows displaying multiple pages of content in a WYSIWYG (What You See Is What You Get) format.  You add content to the document page by page, and specify exactly where each piece of content should be located.

The FixedDocument includes a series of PageContent elements, each of which contains a FixedPage element.

	<FixedDocument>
		<PageContent>
			<!-- 7" x 9" page -->
			<FixedPage Width="672" Height="864">
				<StackPanel Orientation="Vertical" FixedPage.Left="280" FixedPage.Top="150">
					<Label FontFamily="Arial" FontWeight="Bold" FontSize="18" Content="Jane Eyre" HorizontalAlignment="Center"/>
					<Label FontFamily="Arial" FontStyle="Italic" FontSize="14" Content="Charlotte Brontë" HorizontalAlignment="Center"/>
				</StackPanel>
			</FixedPage>
		</PageContent>
		<PageContent>
			<FixedPage Width="672" Height="864">
				<StackPanel Margin="48">
					<TextBlock FontFamily="Cambria" FontSize="14" Width="576" TextWrapping="Wrap">
						There was no possibility etc.
					</TextBlock>
					<TextBlock FontFamily="Cambria" FontSize="14" Width="576" TextWrapping="Wrap" Margin="0,25,0,0">
						I was glad of it etc.
					</TextBlock>
					<Image Margin="0,25,0,0" Source="Twilight.jpg" />
				</StackPanel>
			</FixedPage>
		</PageContent>
	</FixedDocument>

The document shows up in a default viewer.  Here’s page 1:


And page 2:

About these ads

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 365 other followers

%d bloggers like this: