SimpleLink.DetailCount Property

Gets or sets the number of times the SimpleLink.CreateDetail event is raised to create the detail area.

Namespace: DevExpress.Xpf.Printing

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

Declaration

public int DetailCount { get; set; }
Public Property DetailCount As Integer

Property Value

Type Description
Int32

An integer value specifying how many times the detail area should be generated.

Remarks

To generate a report, it is necessary to call the LinkBase.CreateDocument method for the SimpleLink object. After that, the SimpleLink.CreateDetail event is raised as many times as specified by the DetailCount property value.

Examples

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

To do this, perform the following steps.

NOTE

A complete sample project is available at https://github.com/DevExpress-Examples/how-to-use-the-simple-link-e1673.

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];
}
See Also