Back to Devexpress

Command Factory Service

windowsforms-120381-controls-and-libraries-scheduler-services-command-factory-service.md

latest1.8 KB
Original Source

Command Factory Service

  • Sep 20, 2023
  • 3 minutes to read

The ISchedulerCommandFactoryService service allows you to replace default Scheduler commands inside the Bar and Ribbon UI.

View Example

  1. Create a custom command class inherited from the default Scheduler command you want to replace. The Default Scheduler commands are stored in the DevExpress.XtraScheduler.Commands namespace. In the sample code below, a custom command derives from the SplitAppointmentOperationCommand class.

  2. Create a custom class that implements the ISchedulerCommandFactoryService interface. This interface exposes the ISchedulerCommandFactoryService.CreateCommand method you should implement. This method identifies commands by IDs and initializes the corresponding command instances.

  3. Call the SchedulerControl.RemoveService method to remove the default service from the SchedulerControl.Services collection, and use the SchedulerControl.AddService method to add the replacement service.