DXSchedulerControlPrintAdapter.SchedulerControl Property
Gets or sets the SchedulerControl for the print adapter.
Namespace: DevExpress.Xpf.Scheduler.Reporting
Assembly: DevExpress.Xpf.Scheduler.v21.1.dll
NuGet Package: DevExpress.Wpf.Scheduler
Declaration
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.
Example
This example demonstrates how to invoke the Print Preview dialog for SchedulerControl via the PrintHelper.ShowPrintPreviewDialog method.
- Drop the SchedulerControl item onto the form from the DX.21.1.WPF: Scheduling toolbox tab. Bind the scheduler to data.
- Drop the DXSchedulerControlPrintAdapter print adapter onto the form from the DX.21.1.WPF: Scheduling toolbox tab. Set its
DXSchedulerControlPrintAdapter.SchedulerControl
property to the previously created SchedulerControl instance as the data source for the print adapter. - Set the DXSchedulerPrintAdapter.TimeInterval and DXSchedulerPrintAdapter.FirstDayOfWeek properties of the created print adapter.
- Create an instance of the SchedulerPrintingSettings class. Specify its BaseSchedulerPrintingSettings.ReportInstance, BaseSchedulerPrintingSettings.SchedulerPrintAdapter and SchedulerPrintingSettings.ReportTemplatePath properties.
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.v21.1.Core
- DevExpress.PivotGrid.v21.1.Core
- DevExpress.Sparkline.v21.1.Core
- DevExpress.XtraCharts.v21.1
- DevExpress.XtraReports.v21.1
- DevExpress.XtraScheduler.v21.1
- DevExpress.XtraScheduler.Reporting.v21.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 21.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);
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SchedulerControl property.
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.