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

DXSchedulerControlPrintAdapter Class

A print adapter bound to the SchedulerControl.

Namespace: DevExpress.Xpf.Scheduler.Reporting

Assembly: DevExpress.Xpf.Scheduler.v18.2.dll

Declaration

public class DXSchedulerControlPrintAdapter :
    DXSchedulerPrintAdapter

Remarks

Important

You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

Example

This example demonstrates how to invoke the Print Preview dialog for SchedulerControl via the PrintHelper.ShowPrintPreviewDialog method.

  1. Drop the SchedulerControl item onto the form from the DX.18.2.WPF: Scheduling toolbox tab. Bind the scheduler to data.
  2. Drop the DXSchedulerControlPrintAdapter print adapter onto the form from the DX.18.2.WPF: Scheduling toolbox tab. Set its DXSchedulerControlPrintAdapter.SchedulerControl property to the previously created SchedulerControl instance as the data source for the print adapter.
  3. Set the DXSchedulerPrintAdapter.TimeInterval and DXSchedulerPrintAdapter.FirstDayOfWeek properties of the created print adapter.
  4. Create an instance of the SchedulerPrintingSettings class. Specify its BaseSchedulerPrintingSettings.ReportInstance, BaseSchedulerPrintingSettings.SchedulerPrintAdapter and SchedulerPrintingSettings.ReportTemplatePath properties.
  5. Add the Button button onto the form. On its Click event handler, create the SchedulerReportConfigurator class instance and call its SchedulerReportConfigurator.Configure method with the previously specified SchedulerPrintingSettings object passed as a parameter. This will configure the scheduler report (BaseSchedulerPrintingSettings.ReportInstance) by setting its report template and scheduler print adapter to the SchedulerPrintingSettings.ReportTemplatePath and BaseSchedulerPrintingSettings.SchedulerPrintAdapter values respectively.

    Finally, call the PrintHelper.ShowPrintPreviewDialog method with the dialog owner and configured BaseSchedulerPrintingSettings.ReportInstance scheduler report passed as parameters.

Note

To print and preview the SchedulerControl, you need to manually add references to the following libraries:

  • DevExpress.Charts.v18.2.Core
  • DevExpress.PivotGrid.v18.2.Core
  • DevExpress.Sparkline.v18.2.Core
  • DevExpress.XtraCharts.v18.2
  • DevExpress.XtraReports.v18.2
  • DevExpress.XtraScheduler.v18.2
  • DevExpress.XtraScheduler.Reporting.v18.2

Normally, when adding references to these assemblies, you should choose them from the Global Assembly Cache (GAC). However, if you prefer to copy them locally, or need to include them later into your product’s installation, you can find copies of them in the following directory:

C:\Program Files (x86)\DevExpress 18.2\Components\Bin\Framework\

To determine assemblies required to deploy the application, use the Assembly Deployment Tool.

using System;
using System.Windows;
using DevExpress.Xpf.Printing;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Reporting;
using DevExpress.Xpf.Scheduler.Reporting;

namespace SchedulerPrintPreviewSample {
    public partial class MainWindow : Window {

        SchedulerPrintingSettings printingSettings = new SchedulerPrintingSettings();

        public MainWindow() {
            InitializeComponent();

            // Bind the scheduler to data.
            CarsDBDataSet dataSet = new CarsDBDataSet();

            scheduler.Storage.AppointmentStorage.DataSource = dataSet.CarScheduling;
            CarsDBDataSetTableAdapters.CarSchedulingTableAdapter tableAdapter = 
                                            new CarsDBDataSetTableAdapters.CarSchedulingTableAdapter();
            tableAdapter.Fill(dataSet.CarScheduling);

            scheduler.Storage.ResourceStorage.DataSource = dataSet.Cars;
            CarsDBDataSetTableAdapters.CarsTableAdapter carsAdapter = 
                                            new CarsDBDataSetTableAdapters.CarsTableAdapter();
            carsAdapter.Fill(dataSet.Cars);

            // Set the scheduler start date.
            scheduler.Start = new System.DateTime(2010, 7, 15, 0, 0, 0, 0);

            // Specify the time inteval and start day of week used by the print adapter to create a report.
            printAdapter.TimeInterval =
                                new TimeInterval(new DateTime(2010, 7, 15), new DateTime(2010, 7, 30));
            printAdapter.FirstDayOfWeek = FirstDayOfWeek.Wednesday;

            // Specify required printing settings to be passed 
            // to the SchedulerPrintHelper.ShowPrintPreview method that is called on a button click.
            printingSettings.ReportInstance = new XtraSchedulerReport();
            printingSettings.SchedulerPrintAdapter = printAdapter;
            printingSettings.ReportTemplatePath = "WeeklyStyle.schrepx";

        }

        private void bthPreview_Click(object sender, RoutedEventArgs e) {
            // Preview the report.
            SchedulerReportConfigurator configurator = new SchedulerReportConfigurator();
            configurator.Configure(printingSettings);
            PrintHelper.ShowPrintPreviewDialog(this, printingSettings.ReportInstance);
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DXSchedulerControlPrintAdapter class.

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.

Inheritance

Object
DispatcherObject
DependencyObject
Visual
UIElement
FrameworkElement
Control
DevExpress.Xpf.Core.DXDesignTimeControl
DXSchedulerPrintAdapter
DXSchedulerControlPrintAdapter
See Also