﻿<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:annot="clr-namespace:System.Windows.Annotations;assembly=PresentationFramework"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <FlowDocumentReader>
    <FlowDocument
      FontFamily="Calibri"
      FontSize="18">
      <Section>
        <Paragraph
          FontSize="24"
          FontWeight="Bold">
          Documents in WPF

        </Paragraph>
        <Paragraph>
          This is a document marked up in

          <Bold>
            XAML

          </Bold> and displayed by WPF using vector-based graphics and hardware acceleration.


        </Paragraph>
        <Paragraph>
          There are two types of document in WPF. The

          <Italic>
            flow document

          </Italic> and the

          <Italic>
            fixed document

          </Italic>.


        </Paragraph>
        <Paragraph>
          This is a flow document in that its content flows as the space around it changes in order to achieve the best
          layout for the reader including pagination and &quot;column-ation&quot; and taking account of ideas such as not giving the user
          a line of text to read that is so wide as to cause them to have to turn their head when working on a high-res monitor.


        </Paragraph>
        <Paragraph>
          We can include content such as lists


        </Paragraph>
        <List>
          <ListItem>
            <Paragraph>
              Item 1
            </Paragraph>
          </ListItem>
          <ListItem>
            <Paragraph>
              Item 2
            </Paragraph>
          </ListItem>
          <ListItem>
            <Paragraph>
              Item 3
            </Paragraph>
          </ListItem>
          <ListItem>
            <Paragraph>
              Item 4
            </Paragraph>
          </ListItem>
          <ListItem>
            <Paragraph>
              Item 5
            </Paragraph>
          </ListItem>
        </List>
        <Paragraph>
          and tables

        </Paragraph>
        <Table Background="LightGoldenrodYellow">
          <Table.Columns>
            <TableColumn/>
            <TableColumn/>
          </Table.Columns>
          <TableRowGroup>
            <!-- Title row for the table. -->
            <TableRow Background="SkyBlue">
              <TableCell
                ColumnSpan="3"
                TextAlignment="Center">
                <Paragraph FontWeight="Bold">
                  Table Header
                </Paragraph>
              </TableCell>
            </TableRow>
            <!-- Header row for the table. -->
            <TableRow FontWeight="Bold">
              <TableCell>
                <Paragraph>
                  Column 1
                </Paragraph>
              </TableCell>
              <TableCell>
                <Paragraph>
                  Column 2
                </Paragraph>
              </TableCell>
            </TableRow>
            <TableRow Background="LightGray">
              <TableCell>
                <Paragraph>
                  Value 1
                </Paragraph>
              </TableCell>
              <TableCell>
                <Paragraph>
                  Value 2
                </Paragraph>
              </TableCell>
            </TableRow>
            <TableRow Background="LightGray">
              <TableCell>
                <Paragraph>
                  Value 3
                </Paragraph>
              </TableCell>
              <TableCell>
                <Paragraph>
                  Value 4
                </Paragraph>
              </TableCell>
            </TableRow>
          </TableRowGroup>
        </Table>
        <Paragraph>
          The flow document also supports the idea of content that is

          <Italic>
            related

          </Italic> to other content such as the
          picture below which might need to be kept near to a particular piece of text so as to make sense.

        </Paragraph>
        <Paragraph KeepWithNext="True">
          For instance, this piece of text has been told to keep itself with the next image as much as is possible.

        </Paragraph>
        <Paragraph>
          <Image
            Width="2in"
            Height="2in"
            Source="c:\temp\picture.jpg"/>
        </Paragraph>
        <Paragraph>
          The controls at the bottom of this area (find, page-display-mode and zoom) are all provided for free by the
          <Bold>
            FlowDocumentReader
          </Bold>
          that is displaying the content.

        </Paragraph>
        <Paragraph>
          The document also supports the idea of annotations which can be ink or test based and is a service provided free by the
          infrastructure but I can't demonstrate this here as we're doing everything in pure-XAML and (I don't think) you can do
          annotations without a little bit of code.

        </Paragraph>
        <Paragraph>
          By contrast, a fixed-document is more suited to documents such as legal documents where the layout needs to be precisely specified
          in order to comply with regulations.

        </Paragraph>
      </Section>
    </FlowDocument>
  </FlowDocumentReader>
</Page>
