c# programming

20060611

XAML - Displaying Text

XAML has several different ways to display text. The capabilities discussed in this article are for formatting text for printing. XAML uses anti-aliasing to display text so you can zoom in on the text, and it will still appear smooth.

First I will start with the FlowDocumentReader container. The FlowDocumentReader allows me to display what the other containers (FlowDocumentScrollViewer and FlowDocumentPageViewer) will look like. I will cover these other containers another time.

The text included is called Greeking, though I have been told that it is actually Latin. It is included to allow the text to flow over a couple pages.

<FlowDocumentReader
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    Margin="10"
    BorderBrush="Black" BorderThickness="1">
  <FlowDocument
      IsOptimalParagraphEnabled="True"
      IsHyphenationEnabled="True">
    <Paragraph>
Elitr referrentur duo at, ei has facer takimata, mei ei meliore interpretaris. Ea qui admodum blandit, sea ea dicta munere putent. Eu erat homero virtute quo, ad est probo officiis expetendis. Euismod vituperatoribus aeque at eam, quodsi dolorum necessitatibus ad pri. Novum aliquando eos ex. Qui sint lobortis incorrupte ei, impedit recusabo duo no.
    </Paragraph>
    <Paragraph>
Primis maluisset nam te. Senserit prodesset duo cu, wisi maluisset consectetuer ne mei. Eum probo aliquid minimum ad. Prima nullam persequeris cum ei, cum ad paulo assueverit consectetuer. Officiis atomorum est cu, et dolorem nusquam his, eam ea odio commodo. Unum autem dicam mea ad, malis tincidunt adversarium usu ea. Vocent fuisset singulis in eum, sea ad tation graeci iisque, cum ut essent volumus.
    </Paragraph>
    <Paragraph>
Et sea dico feugait definitiones, usu electram deterruisset interpretaris ex. His at vocent delenit, vis lucilius tractatos in. Affert explicari usu id. Eum amet suscipiantur ne, quem sale delenit mea in. In soluta doming vim, in quo virtute disputationi, in etiam nostrud appareat quo. Mei ad definitionem concludaturque.
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

Let's look at what this code does. The FlowDocumentReader allows the user to choose how he would like to view the text. He is given the choice of "Page Mode", "Two Page Mode", and "Scroll Mode". The user is also given the ability to search the text and zoom in or zoom out.

It appears as though you must have only one FlowDocument tag inside the FlowDocumentReader tag. You can also have as many Paragraph tags inside the FlowDocument tag as you would like.

0 Comments:

Post a Comment

<< Home