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

DataViewBase.ShowPrintPreviewDialog(Window, String) Method

Creates the print document from the DataViewBase and displays the modal Print Preview of the document using the specified owner and document name.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v19.1.Core.dll

Declaration

public void ShowPrintPreviewDialog(
    Window owner,
    string documentName
)

Parameters

Name Type Description
owner Window

A Window instance specifying the owner of the Print Preview.

documentName String

A String value specifying what name should be used for the document to be displayed in the Print Preview.

Remarks

The Print Preview displays the grid as it will appear when printed. Note that the grid can be previewed and printed only if the DXPrinting Library is available.

To print the grid, use the DataViewBase.PrintDirect and DataViewBase.Print methods. To export the grid, use the appropriate ExportTo~ method (e.g. DataViewBase.ExportToHtml, DataViewBase.ExportToPdf, etc.)

Example

This example shows how to preview and print/export the grid content. The grid is printed and exported using the built-in capabilities.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DXGrid_PrintGrid {
    public class IssueList {
        public List<IssueDataObject> List { get; private set; }
        public IssueList() {
            List = GetIssueList();
        }
        List<IssueDataObject> GetIssueList() {
            List<IssueDataObject> data = new List<IssueDataObject>();
            data.Add(new IssueDataObject() { IssueName = "Transaction History", IssueType = "Bug", IsPrivate = true });
            data.Add(new IssueDataObject() { IssueName = "Ledger: Inconsistency", IssueType = "Bug", IsPrivate = false });
            data.Add(new IssueDataObject() { IssueName = "Data Import", IssueType = "Request", IsPrivate = false });
            data.Add(new IssueDataObject() { IssueName = "Data Archiving", IssueType = "Request", IsPrivate = true });
            return data;
        }
    }
    public class IssueDataObject {
        public string IssueName { get; set; }
        public string IssueType { get; set; }
        public bool IsPrivate { get; set; }
    }
}
See Also