Document Viewer
- 3 minutes to read
This topic explains the functionality of the Document Viewer.
The following sections are available in this topic.
#General Functionality
DXPrinting for Silverlight provides the DocumentViewer control for showing a document's print preview.
The Document Viewer displays data provided to it by a view model (LinkPreviewModel or ). The basic functionality for models is provided by the IDocumentPreviewModel interface. You can implement this interface to define your own custom view model as well.
When a document is created (either the DocumentPreviewModelBase.CreateDocument method is called or the DocumentViewer.AutoCreateDocument property is enabled), it is shown in the Document Viewer.
While a document is being generated, its progress is reflected in the Progress Bar, which is shown in the following image.
The Document Viewer includes the BarManager or RibbonControl, which displays buttons for a document's navigation, as well as its printing and exporting.
Each toolbar button triggers a specific command. For example, after clicking the Page Setup... button, the Page Setup dialog appears, which is shown in the following image.
Note that unless an Export Server is added to a Web application, exporting is not available, and the corresponding buttons are disabled in the Document Viewer. For details on this, see Printing and Exporting.
#Additional Functionality
Document Map Panel
When the Document Map is available in a report, the corresponding button becomes available in the toolbar, which triggers DocumentPreviewModelBase.ToggleDocumentMapCommand. This command defines the visibility of the Document Map panel.
The Document Map panel allows your end-users to quickly navigate through the document, using specified bookmarks.
To check whether or not the Document Map panel is visible, use the DocumentPreviewModelBase.IsDocumentMapVisible property.
Parameters Panel
And, if a report has visible parameters, the corresponding button becomes available, which triggers DocumentPreviewModelBase.ToggleParametersPanelCommand. This command defines the visibility of the Parameters panel.
The Parameters user interface allows your end-users to modify the parameter values and update the document appropriately.
To check whether or not the Parameters panel is visible, use the DocumentPreviewModelBase.IsParametersPanelVisible property.
See also: How to: Provide Custom Editors for Report Parameters.
#Interactivity
You can add interactivity to reports shown in a Document Viewer (e.g., to create drill-down and drill-through reports, or enable report sorting in the Document Viewer).
To do this, handle the DocumentPreviewModelBase.PreviewClick and DocumentPreviewModelBase.PreviewMouseMove events.
#Customization
It is possible to choose from a set of pre-defined themes that define the appearance of the Document Viewer. For more information on this, see Themes.
You can customize the main toolbar of the Document Viewer by removing the standard buttons from the BarManager or adding your own custom ones.
To do this, create a customization template and assign it to the BarManagerCustomization.Template property.