views:

50

answers:

1

Hi,

i am trying to add Headers / footers to a WPF FlowDocument. I Found a solution on the Internet here that is using a custom Paginator Class to do this. Unfortunately this only works when printing out the Document, which is not what I intend to do. My Idea was to use a FlowDocumentPageReader or something similar with a custom paginator, but somehow i cant figure out how I would do that, maybe anyone can give me a hint in the right Direction.

Thanks, Robert.

+1  A: 

If you are just displaying the FlowDocument and not printing it, you can implement headers and footers by creating a control template for the FlowDocumentPageViewer.

In the template, place textblocks above and below the DocumentPageView, and bind them to the appropriate values.

For example, if you want a page number:

<TextBlock Text="{Binding Path=MasterPageNumber, RelativeSource={RelativeSource TemplatedParent}" FontSize="14" FontWeight="Bold" />

and so on for title, etc.

You can wrap the textblocks and DocumentPageView with a border so the whole thing appears as one page.

Bear
Yes that works, thanks for the answer. In the meantime i have hacked some stuff together myself, but im gonna try this out right away!
Robert J.