The text system in WPF is primarily designed for playing around with text for use in UIs, not for producing complex documents with footnotes and headers etc. However, the framework has been written so that if you want to add custom functionality, you can.
First problem: Footnotes and stuff that is in-line with the text. WPF provides 2 classes to put UIElement
s in text: InlineUIContainer
and BlockUIContainer
. I would consider writing your own custom control that is specially designed to have the behaviour of a footnote or something similar and put it in one of those two classes. I found this handy-dandy relationship chart on MSDN if you need more info on what accepts what (links are at the bottom of the page)
I’m not completely sure what you mean by “magazine style story flow”. 'FlowDocument' will automatically arrange Block
-derived classes (anything in blue on the above chart) into the available space and you can make the text ‘flow’ around objects using the Floater
and Figure
inline elements. You could also use Figure
and Floater
for your headers and footers feature.
Here is some example code:
<FlowDocumentScrollViewer>
<FlowDocument>
<Paragraph>
5 green bottles standing on the wall,
5 green bottles standing on the wall,
and if one green bottle was to accidentally fall,
there would be 4 green bottles standing on the wall;
</Paragraph>
<Paragraph>
4 green bottles standing on the wall,
4 green bottles standing on the wall,
<Floater HorizontalAlignment="Left" Width="250">
<BlockUIContainer>
<Button>This button is in a Floater</Button>
</BlockUIContainer>
</Floater>
and if one green bottle was to accidentally fall,
there would be 3 green bottles standing on the wall;
</Paragraph>
<Paragraph>
3 green bottles standing on the wall,
3 green bottles standing on the wall,
and if one green bottle was to accidentally fall,
there would be 2 green bottles standing on the wall;
</Paragraph>
<Paragraph>
2 green bottles standing on the wall,
2 green bottles standing on the wall,
and if one green bottle was to accidentally fall,
<InlineUIContainer>
<Button>This Button is inline</Button>
</InlineUIContainer>
there would be 1 green bottle standing on the wall...
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
You can replace the Button
s with your own custom controls (eg. the inline button with your footnote thang)
This code makes this:
I hope that helps! I don't know exactly what you are trying to do but I would think that you could still use FlowDocument
and just use the large amount of text manipulating equipment provided with WPF and if you do need extra functionality/ layout options create a new class inheriting Block
or Inline
or whatever and write the extra stuff in there to take advantage of all the work .net can do for you.
If you need more information you can read more about text stuff in WPF on MSDN:
Extra long article about how to use FlowDocument
The text content model used in WPF (where I got the image from)
Enjoy yourself :)