Skip to main content
A newer version of this page is available. .

PrintHelper Class

Provides methods to display a Print Preview for links, grids and reports.

Namespace: DevExpress.Xpf.Printing

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Printing, DevExpress.Wpf.Printing

Declaration

public static class PrintHelper

Remarks

To create a custom Print Preview window, use the DocumentPreviewWindow class.

Example

This example demonstrates how to use SimpleLink to print data from a non-hierarchical datasource.

To do this, perform the following steps.

View Example

using System;
using System.Globalization;
using System.Windows;
using DevExpress.Xpf.Printing;
// ...
string[] data;

private void button1_Click(object sender, RoutedEventArgs e) {
    // Create an array of strings.
    data = CultureInfo.CurrentCulture.DateTimeFormat.DayNames;

    // Create a link and specify a template and detail count for it.
    SimpleLink link = new SimpleLink();
    link.DetailTemplate = (DataTemplate)Resources["dayNameTemplate"];
    link.DetailCount = data.Length;

    // Create a document.
    link.CreateDetail += new EventHandler<CreateAreaEventArgs>(link_CreateDetail);

    // Show a Print Preview window.
    PrintHelper.ShowPrintPreviewDialog(this, link);
}

void link_CreateDetail(object sender, CreateAreaEventArgs e) {
    e.Data = data[e.DetailIndex];
}

Inheritance

Object
PrintHelper
See Also