A newer version of this page is available. Switch to the current version.

SchedulerPrintAdapter.GetService(Type) Method

Gets the service object of the specified type.

Namespace: DevExpress.XtraScheduler.Reporting

Assembly: DevExpress.XtraScheduler.v19.1.Core.dll


public object GetService(
    Type serviceType


Name Type Description
serviceType Type

An object that specifies the type of service object to get.


Type Description

A service object of the specified type, or a null reference (Nothing in Visual Basic) if there is no service object of this type.


Use this method to enable your application objects to obtain a service of the SchedulerControl in order to employ its methods. The scheduler implements the IServiceProvider interface, so you can tell it what type of service you wish to retrive via the GetService method; and if a service is available, it is offered to the caller object.


Currently only the SchedulerStoragePrintAdapter supports services. You should check the type of the print adapter and cast it to the SchedulerStoragePrintAdapter type.

The following code snippet illustrates how the HeaderCaptionService is substituted to modify the date format of the header caption. Other services can be used similarly.

using DevExpress.XtraScheduler.Reporting;
using DevExpress.XtraScheduler.Services;
using DevExpress.XtraScheduler.Drawing;
using DevExpress.XtraScheduler.Services.Implementation;
// ...
    string dateFormat = "dd-MMM, ddd";
    SchedulerStoragePrintAdapter storagePrintAdapter = 
        XtraSchedulerReport1.SchedulerAdapter as SchedulerStoragePrintAdapter;
    if (storagePrintAdapter != null) {
        IHeaderCaptionService customHeaderCaptionService = 
            new CustomHeaderCaptionService(dateFormat);

public class CustomHeaderCaptionService : HeaderCaptionServiceWrapper {
    string format;
    public CustomHeaderCaptionService(string format)
        : base(new HeaderCaptionService()) {
        this.format = format;
    protected virtual string CreateFormat(string format) {
        if(format == "Default")
            return string.Empty;
        return String.Format("{{0:{0}}}", format);
    public override string GetDayColumnHeaderCaption(DayHeader header) {
        return CreateFormat(format);
See Also