This article is currently in the process of being translated into French (~31% done).
If you are fluent in French, then please help us - just point to any untranslated element inside the article and click the translation button to get started. Or have a look at the current translation status for the French 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
Dans d'autres frameworks d'interface utilisateur, tels que WinForm, afficher de larges quantités de texte richement formaté a pu être un problème. Bien sûr, vous pourriez charger un fichier dans un RichTextBox ou vous pourriez créer un objet WebBrowser et charger une page web locale ou en réseau. Cependant, déclarer de large quantité de texte richement formaté en temps réel n'était pas vraiment possible. Il semble que Microsoft ait décidé de remédier à cela dans WPF et d'aller encore plus loin que l'affichage simple de texte.
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 - le plus simple encadreur atour d'un FlowDocument, qui affiche simplement le document comme un long document de texte dans le lequel vous pouvez scroller.
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.