DXSchedulerControlPrintAdapter.SchedulerControl Property

Gets or sets the SchedulerControl for the print adapter.

Namespace: DevExpress.Xpf.Scheduler.Reporting

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

Declaration

public SchedulerControl SchedulerControl { get; set; }
Public Property SchedulerControl As SchedulerControl

Property Value

Type Description
SchedulerControl

A SchedulerControl object specifying a scheduler control.

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.

Use the SchedulerControl property to specify a scheduler for which a report is built.

Examples

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.20.1.WPF: Scheduling toolbox tab. Bind the scheduler to data.
  2. Drop the DXSchedulerControlPrintAdapter print adapter onto the form from the DX.20.1.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.v20.1.Core
  • DevExpress.PivotGrid.v20.1.Core
  • DevExpress.Sparkline.v20.1.Core
  • DevExpress.XtraCharts.v20.1
  • DevExpress.XtraReports.v20.1
  • DevExpress.XtraScheduler.v20.1
  • DevExpress.XtraScheduler.Reporting.v20.1

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 20.1\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);
        }
    }
}
See Also