windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-dot-addservice-x28-system-dot-type-system-dot-object-x29.md
Adds the specified service to the service container.
Namespace : DevExpress.XtraScheduler
Assembly : DevExpress.XtraScheduler.v25.2.dll
NuGet Package : DevExpress.Win.Scheduler
public void AddService(
Type serviceType,
object serviceInstance
)
Public Sub AddService(
serviceType As Type,
serviceInstance As Object
)
| Name | Type | Description |
|---|---|---|
| serviceType | Type |
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.
|
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
schedulerControl1.RemoveService(typeof(IAppointmentFormatStringService));
schedulerControl1.AddService(typeof(IAppointmentFormatStringService), customAppointmentFormatStringService);
winforms-scheduler-replace-default-command/CS/WindowsFormsApplication1/Form1.cs#L30
schedulerControl1.RemoveService(typeof(ISchedulerCommandFactoryService));
schedulerControl1.AddService(typeof(ISchedulerCommandFactoryService), commandFactory);
winforms-scheduler-formatting-services/VB/FormattingServicesExample/Form1.vb#L65
schedulerControl1.RemoveService(GetType(IAppointmentFormatStringService))
schedulerControl1.AddService(GetType(IAppointmentFormatStringService), customAppointmentFormatStringService)
schedulerControl1.RemoveService(GetType(ITimeRulerFormatStringService))
winforms-scheduler-replace-default-command/VB/WindowsFormsApplication1/Form1.vb#L30
schedulerControl1.RemoveService(GetType(ISchedulerCommandFactoryService))
schedulerControl1.AddService(GetType(ISchedulerCommandFactoryService), commandFactory)
See Also