Back to Devexpress

SchedulerControl.AddService(Type, Object) Method

windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-dot-addservice-x28-system-dot-type-system-dot-object-x29.md

latest4.8 KB
Original Source

SchedulerControl.AddService(Type, Object) Method

Adds the specified service to the service container.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public void AddService(
    Type serviceType,
    object serviceInstance
)
vb
Public Sub AddService(
    serviceType As Type,
    serviceInstance As Object
)

Parameters

NameTypeDescription
serviceTypeType

The type of service to add.

| | serviceInstance | Object |

An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter.

|

Remarks

The SchedulerControl implements IServiceProvider and IServiceContainer interfaces. In addition to providing services, it also provides a mechanism for adding and removing services. To obtain a service, call the SchedulerControl.GetService method.

For more information review the Introduction to Services in XtraScheduler topic.

The following code snippets (auto-collected from DevExpress Examples) contain references to the AddService(Type, Object) 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.

winforms-scheduler-formatting-services/CS/FormattingServicesExample/Form1.cs#L57

csharp
schedulerControl1.RemoveService(typeof(IAppointmentFormatStringService));
schedulerControl1.AddService(typeof(IAppointmentFormatStringService), customAppointmentFormatStringService);

winforms-scheduler-replace-default-command/CS/WindowsFormsApplication1/Form1.cs#L30

csharp
schedulerControl1.RemoveService(typeof(ISchedulerCommandFactoryService));
schedulerControl1.AddService(typeof(ISchedulerCommandFactoryService), commandFactory);

winforms-scheduler-formatting-services/VB/FormattingServicesExample/Form1.vb#L65

vb
schedulerControl1.RemoveService(GetType(IAppointmentFormatStringService))
schedulerControl1.AddService(GetType(IAppointmentFormatStringService), customAppointmentFormatStringService)
schedulerControl1.RemoveService(GetType(ITimeRulerFormatStringService))

winforms-scheduler-replace-default-command/VB/WindowsFormsApplication1/Form1.vb#L30

vb
schedulerControl1.RemoveService(GetType(ISchedulerCommandFactoryService))
schedulerControl1.AddService(GetType(ISchedulerCommandFactoryService), commandFactory)

See Also

Services

GetService(Type)

RemoveService

Services

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace