Document Viewer for Silverlight

  • 2 minutes to read

The Document Viewer is used to display report previews in Silverlight applications.

Invoking the Document Viewer

The XtraReports Suite's DocumentViewer control is used to publish reports in Silverlight applications. The Document Viewer can also display a toolbar (a BarManager or RibbonControl) with buttons for various document operations.

document-preview-silverlight

To show a report in a Document Viewer, add a DocumentViewer instance to your Silverlight application.

drop-control-document-preview-silverlight-14-2

Then, perform the following steps.

  1. Add a report and ReportService to the application.
  2. Enable the Document Viewer's AutoCreateDocument property and define its DocumentViewer.Model property as follows:

    <dxp:DocumentViewer Name="documentViewer1" AutoCreateDocument="True">
        <dxp:DocumentViewer.Model>
            <dxp:ReportPreviewModel ServiceUri="../ReportService1.svc"
                                    ReportName="SilverlightApplication1.Web.XtraReport1" />
        </dxp:DocumentViewer.Model>
    </dxp:DocumentViewer>
    
  3. You can also customize the Document Viewer, which is demonstrated in the following online example: How to customize the DocumentPreview toolbar.

Document Viewer Features

The Document Viewer provides the following options for performing various operations on the document.

  • Document Map panel - displays a report's table of contents.
  • Parameters panel - used to set the values of report parameters.
  • Page Setup button - invokes a dialog to set a document's paper format, page orientation and margins.
  • Zooming controls - the Zoom drop-down button, as well as the Zoom In and Zoom Out buttons, make the report appear larger or smaller on the screen.
  • Navigation buttons - allow you to switch between report pages.
  • Export drop-down buttons - allow you to export a report to various formats.
  • Watermark button - invokes a dialog to add a new text or image watermark to a report or customize an existing one.