Back to Devexpress

SchedulerPrintAdapter.AssignToReport(ISchedulerReport) Method

wpf-devexpress-dot-xpf-dot-scheduling-dot-reporting-dot-schedulerprintadapter-dot-assigntoreport-x28-devexpress-dot-xtrascheduler-dot-reporting-dot-ischedulerreport-x29.md

latest5.5 KB
Original Source

SchedulerPrintAdapter.AssignToReport(ISchedulerReport) Method

Assigns the SchedulerPrintAdapter instance to the given report.

Namespace : DevExpress.Xpf.Scheduling.Reporting

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

NuGet Package : DevExpress.Wpf.Scheduling

Declaration

csharp
public void AssignToReport(
    ISchedulerReport report
)
vb
Public Sub AssignToReport(
    report As ISchedulerReport
)

Parameters

NameTypeDescription
reportDevExpress.XtraScheduler.Reporting.ISchedulerReport

An object exposing the ISchedulerReport interface, which represents the report to be bound to the print adapter.

|

Example

This code snippet contains the PrintScheduler method which performs the following tasks:

  • Instantiate the XtraSchedulerReport descendant. The class can be designed in Visual Studio or loaded from a template.
  • Specify the time interval of the report’s scheduler data.
  • Connect the SchedulerPrintAdapter to the report instance.
  • Call the PrintHelper.ShowPrintPreview method to create a document and display it using the built-in document preview window.

View Example

csharp
using DevExpress.Mvvm;
using DevExpress.Xpf.Printing;
using DevExpress.Xpf.Printing.Native;
using DevExpress.Xpf.Scheduling;
using DevExpress.XtraPrinting.Native;
using System.Windows;

namespace PrintingExample {
    public static class MyPrintHelper {
        public static Window mainWindow { get; set; }

        public static void PrintScheduler(SchedulerControl scheduler) {
            XtraSchedulerReport1 report = new XtraSchedulerReport1();
            DateTimeRange dateTimeRange = scheduler.VisibleIntervals[0];
            scheduler.SchedulerPrintAdapter.DateTimeRange = dateTimeRange;
            scheduler.SchedulerPrintAdapter.AssignToReport(report);
            PrintHelper.ShowPrintPreview(mainWindow, report);
        }
    }
}
vb
Imports DevExpress.Mvvm
Imports DevExpress.Xpf.Printing
Imports DevExpress.Xpf.Printing.Native
Imports DevExpress.Xpf.Scheduling
Imports DevExpress.XtraPrinting.Native
Imports System.Windows

Namespace PrintingExample
    Public NotInheritable Class MyPrintHelper

        Private Sub New()
        End Sub

        Public Shared Property mainWindow() As Window

        Public Shared Sub PrintScheduler(ByVal scheduler As SchedulerControl)
            Dim report As New XtraSchedulerReport1()
            Dim dateTimeRange As DateTimeRange = scheduler.VisibleIntervals(0)
            scheduler.SchedulerPrintAdapter.DateTimeRange = dateTimeRange
            scheduler.SchedulerPrintAdapter.AssignToReport(report)
            PrintHelper.ShowPrintPreview(mainWindow, report)
        End Sub
    End Class
End Namespace

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AssignToReport(ISchedulerReport) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-scheduler-use-scheduler-report-to-print-and-export-appointments/CS/PrintingExample/MyPrintHelper.cs#L17

csharp
scheduler.SchedulerPrintAdapter.DateTimeRange = dateTimeRange;
scheduler.SchedulerPrintAdapter.AssignToReport(report);
PrintHelper.ShowPrintPreview(mainWindow, report);

wpf-scheduler-use-scheduler-report-to-print-and-export-appointments/VB/PrintingExample/MyPrintHelper.vb#L17

vb
scheduler.SchedulerPrintAdapter.DateTimeRange = dateTimeRange
scheduler.SchedulerPrintAdapter.AssignToReport(report)
PrintHelper.ShowPrintPreview(mainWindow, report)

See Also

Printing

SchedulerPrintAdapter Class

SchedulerPrintAdapter Members

DevExpress.Xpf.Scheduling.Reporting Namespace