Back to Devexpress

DocumentPreviewWindow Class

wpf-devexpress-dot-xpf-dot-printing-dc43749b.md

latest3.8 KB
Original Source

DocumentPreviewWindow Class

A window containing a Print Preview.

Namespace : DevExpress.Xpf.Printing

Assembly : DevExpress.Xpf.Printing.v25.2.dll

NuGet Package : DevExpress.Wpf.Printing

Declaration

csharp
public class DocumentPreviewWindow :
    ThemedWindow,
    IComponentConnector
vb
Public Class DocumentPreviewWindow
    Inherits ThemedWindow
    Implements IComponentConnector

Remarks

To display a default Print Preview without creating a custom preview window, use the methods of the PrintHelper class.

To create a custom Print Preview window, assign a corresponding XtraReport or link to the DocumentViewerControl.DocumentSource property (available via the DocumentPreviewWindow.PreviewControl property).

csharp
using DevExpress.Xpf.Printing;
using System.Windows;
// ...

private void Button_Click(object sender, RoutedEventArgs e) {
    XtraReport1 report = new XtraReport1();
    var window = new DocumentPreviewWindow();
    window.PreviewControl.DocumentSource = report;
    report.CreateDocument();
    window.Show();
}
vb
Imports DevExpress.Xpf.Printing
Imports System.Windows
' ...

Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
    Dim report As New XtraReport1()
    Dim window = New DocumentPreviewWindow()
    window.PreviewControl.DocumentSource = report
    report.CreateDocument()
    window.Show()
End Sub

Make sure to call the XtraReport.CreateDocument method before displaying the Print Preview.

For step-by-step tutorials, see Document Preview and How to: Use the Simple Link.

Inheritance

Show 11 items

Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control ContentControl Window ThemedWindow DocumentPreviewWindow

See Also

DocumentPreviewWindow Members

DocumentPreviewControl

Print Reports in WPF

DevExpress.Xpf.Printing Namespace