FlowDocumentReader Class

Provides a control for viewing flow content, with built-in support for multiple viewing modes.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[ContentPropertyAttribute("Document")]
[TemplatePartAttribute(Name = "PART_ContentHost", Type = typeof(Decorator))]
[TemplatePartAttribute(Name = "PART_FindToolBarHost", Type = typeof(Decorator))]
public class FlowDocumentReader : Control, 
	IAddChild
<FlowDocumentReader>
  Document
</FlowDocumentReader>

FlowDocumentReader includes features that enable the user to dynamically choose between various viewing modes, including a single-page (page-at-a-time) viewing mode, a two-page-at-a-time (book reading format) viewing mode, and a continuous scrolling (bottomless) viewing mode. If you do not need the ability to dynamically switch between different viewing modes, there are lighter-weight flow content viewers that are fixed in a particular viewing mode. FlowDocumentPageViewer displays flow content in single-page viewing mode, and FlowDocumentScrollViewer displays flow content in continuous-scrolling mode. For more information about available display modes, see FlowDocumentReaderViewingMode.

The following figure shows a FlowDocumentReader control with its default user interface (UI).

Screenshot with callouts: FlowDocumentReader
  • Content Area - The content area displays the contents of the FlowDocument specified by the Document property.

  • Tool Bar - The default toolbar is docked underneath the content area. It hosts controls for searching content, navigating pages, selecting a viewing mode, and changing the zoom level.

    • Find Button - The Find button brings up a Find dialog, which enables the user to search the contents of the FlowDocumentReader for specified terms or phrases. The Find button is not shown if IsFindEnabled is false. For more information, see Find.

    • Page Navigation Controls - The page navigation controls include a button to jump to the next page (the down arrow) or previous page (the up arrow), as well as indicators for the current page number and total number of pages.

    • Viewing Mode Buttons - The viewing mode buttons enable the user to select from available viewing modes. For more information, see ViewingMode.

    • Zoom Controls - The zoom controls enable the user to increase or decrease the zoom level by clicking the plus or minus buttons, respectively. The zoom controls also include a slider for adjusting the zoom level. For more information, see Zoom.

The default toolbar UI does not include a Print button.

FlowDocument is the only allowable child element for a FlowDocumentReader. A FlowDocumentReader element can host no more than one FlowDocument.

The following example defines the FlowDocumentReader pictured in the preceding figure.

<FlowDocumentReader>
  <FlowDocument 
    ColumnWidth="400" 
    IsOptimalParagraphEnabled="True" IsHyphenationEnabled="True"
    >
    <Section FontSize="12">
      <Paragraph>
        <Bold>Neptune</Bold> (planet), major planet in the solar system, eighth planet
        from the Sun and fourth largest in diameter.  Neptune maintains an almost constant
        distance, about 4,490 million km (about 2,790 million mi), from the Sun.  Neptune
        revolves outside the orbit of Uranus and for most of its orbit moves inside the
        elliptical path of the outermost planet Pluto (see Solar System). Every 248 years,
        Pluto’s elliptical orbit brings the planet inside Neptune’s nearly circular orbit
        for about 20 years, temporarily making Neptune the farthest planet from the Sun.
        The last time Pluto’s orbit brought it inside Neptune’s orbit was in 1979. In
        1999 Pluto’s orbit carried it back outside Neptune’s orbit.

        <!-- This Figure uses relative measurements for width and height. -->
        <Figure 
          Width="0.25" Height="0.1" Background="GhostWhite" 
          HorizontalAnchor="PageLeft" 
          HorizontalOffset="100" VerticalOffset="20"
          >
          <Paragraph 
            FontStyle="Italic" TextAlignment="Left"
            Background="Beige" Foreground="DarkGreen"
            >
            Neptune has 72 times Earth's volume...
          </Paragraph>
        </Figure>

        <!-- This Floater uses relative measurements for width. -->
        <Floater 
          Background="GhostWhite" 
          Width="0.4" HorizontalAlignment="Left"
          >
          <Table CellSpacing="5">
            <Table.Columns>
              <TableColumn Width="155"/>
              <TableColumn Width="130"/>
            </Table.Columns>

            <TableRowGroup>
              <TableRow>
                <TableCell ColumnSpan="3">
                  <Paragraph>Neptune Stats</Paragraph>
                </TableCell>
              </TableRow>

              <TableRow Background="LightGoldenrodYellow" FontSize="12">
                <TableCell>
                  <Paragraph FontWeight="Bold">Mean Distance from Sun</Paragraph>
                </TableCell>
                <TableCell>
                  <Paragraph>4,504,000,000 km</Paragraph>
                </TableCell>
              </TableRow>

              <TableRow FontSize="12" Background="LightGray">
                <TableCell>
                  <Paragraph FontWeight="Bold">Mean Diameter</Paragraph>
                </TableCell>
                <TableCell>
                  <Paragraph>49,532 km</Paragraph>
                </TableCell>
              </TableRow>

              <TableRow Background="LightGoldenrodYellow" FontSize="12">
                <TableCell>
                  <Paragraph FontWeight="Bold">Approximate Mass</Paragraph>
                </TableCell>
                <TableCell>
                  <Paragraph>1.0247e26 kg</Paragraph>
                </TableCell>
              </TableRow>
              <TableRow>
                <TableCell ColumnSpan="4">
                  <Paragraph FontSize="10" FontStyle="Italic">
                    Information from the
                    <Hyperlink 
                      NavigateUri="http://encarta.msn.com/encnet/refpages/artcenter.aspx"
                      >Encarta</Hyperlink>
                    web site.
                  </Paragraph>
                </TableCell>
              </TableRow>
            </TableRowGroup>
          </Table>
        </Floater>
      </Paragraph>
      <Paragraph>
        Astronomers believe Neptune has an inner rocky core that is surrounded by a vast
        ocean of water mixed with rocky material. From the inner core, this ocean extends
        upward until it meets a gaseous atmosphere of hydrogen, helium, and trace amounts
        of methane. Neptune has four rings and 11 known moons. Even though Neptune's volume
        is 72 times Earth’s volume, its mass is only 17.15 times Earth’s mass. Because of
        its size, scientists classify Neptune—along with Jupiter, Saturn, and Uranus—as
        one of the giant or Jovian planets (so-called because they resemble Jupiter).
      </Paragraph>
      <Paragraph>
        <Figure 
          Width="140" Height="50" 
          Background="GhostWhite" TextAlignment="Left" 
          HorizontalAnchor="PageCenter" WrapDirection="Both"
          >
          <Paragraph FontStyle="Italic" Background="Beige" Foreground="DarkGreen" >
            Neptune has an orbital period of ~20 years...
          </Paragraph>
        </Figure>
        Mathematical theories of astronomy led to the discovery of Neptune. To account for
        wobbles in the orbit of the planet Uranus, British astronomer John Couch Adams and
        French astronomer Urbain Jean Joseph Leverrier independently calculated the existence
        and position of a new planet in 1845 and 1846, respectively. They theorized that the
        gravitational attraction of this planet for Uranus was causing the wobbles in Uranus’s
        orbit. Using information from Leverrier, German astronomer Johann Gottfried Galle first
        observed the planet in 1846.
      </Paragraph>
    </Section>
  </FlowDocument>
</FlowDocumentReader>

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            System.Windows.Controls.Control
              System.Windows.Controls.FlowDocumentReader

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft