The community is working on translating this tutorial into Norwegian Bokmål, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".
If you are fluent in Norwegian Bokmål, then please help us - just point to any untranslated element (highlighted with a yellow left border - remember that images should have their titles translated as well!) inside the article and click the translation button to get started. Or have a look at the current translation status for the Norwegian Bokmål language.
If you see a translation that you think looks wrong, then please consult the original article to make sure and then use the vote button to let us know about it.
Please help us by translating the following metadata for the article/chapter, if they are not already translated.
If you are not satisfied with the translation of a specific metadata item, you may vote it down - when it reaches a certain negative threshold, it will be removed. Please only submit an altered translation of a metadata item if you have good reasons to do so!
Introduction to WPF Rich Text controls
In other UI frameworks like WinForms, displaying large amounts of richly formatted text has been somewhat of a problem. Sure, you could load a file into a RichTextBox or you could create a WebBrowser object and load a local or remote web page, but specifying larger amounts of rich text in design-time wasn't really possible. It seems that Microsoft wanted to remedy that in WPF and even go beyond just simple viewing of the text.
The FlowDocument does indeed render rich text, and that even includes images, lists and tables, and elements can be floated, adjusted and so on, and using a FlowDocument, you can specify rich text in design-time as if it were HTML (thanks to XAML) and have it rendered directly in your WPF application.
The FlowDocument doesn't stand alone. Instead, it uses one of several built-in wrappers, which controls how the FlowDocument is laid out and whether the content can be edited by the user or not. WPF includes three controls for rendering a FlowDocument in read-only mode, which all has easy support for zooming and printing:
FlowDocumentScrollViewer - the simplest wrapper around a FlowDocument, which simply displays the document as one long document of text which you can scroll in.
FlowDocumentPageViewer - this wrapper will automatically split your document into pages, which the user can navigate back and forth between.
FlowDocumentReader - a combination of the FlowDocumentScrollViewer and the FlowDocumentPageViewer, which will let the user decide between the two rendering modes. It also offers the ability AND the interface to search in the document.
The FlowDocument is normally read-only, but put it inside of a RichTextBox control (described later in this tutorial) and you can now edit the text, much like in real word processors like Microsoft Word.
Read on through the next chapters, where we'll discuss all the wrappers that you can use with a FlowDocument, both read-only and editable. After that, we'll look into all of the possibilities you have when creating rich documents using the FlowDocument, including tables, lists, images and much more.