This breaking change was introduced because the older Document Preview used XAML rendering to create documents, unlike the new Document Preview that uses GDI rendering.
The following classes have become obsolete:
- DocumentPreview;
- DocumentViewer;
- RibbonDocumentPreviewWindow;
- LegacyLinkPreviewModel;
- LinkPreviewModel;
- PrintingSystemPreviewModel;
- ReportServicePreviewModel;
- XtraReportPreviewModel.
The DocumentPreviewWindow.Model property is no longer available.
The following code illustrates how to create and initialize a Print Preview window:
C#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();
}
Visual BasicImports 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
To display a default Print Preview without creating a custom preview window, you can still use the methods of the PrintHelper class:
C#PrintHelper.ShowPrintPreviewDialog(ownerWindow, report);
To use this functionality, add a reference to the DevExpress.Xpf.DocumentViewer.v16.1.Core assembly to your application.