The WinForms Scheduler Control exposes the ISchedulerCommandFactoryService interface that enables you to substitute the default command with your own (custom) command. This example replaces the default SplitAppointmentOperationCommand with a custom command. The custom command has the SplitAppointmentCommandStep property that specifies a fixed split operation's step.
publicclassCustomSplitAppointmentOperationCommand:SplitAppointmentOperationCommand{publicCustomSplitAppointmentOperationCommand(ISchedulerCommandTargettarget):base(target){}publicCustomSplitAppointmentOperationCommand(SchedulerControlcontrol):base(control){}privateTimeSpansplitInterval=TimeSpan.FromMinutes(10);publicTimeSpanSplitAppointmentCommandStep{get{returnsplitInterval;}set{splitInterval=value;}}protectedoverrideIOperationCreateOperation(){TimeScaleCollectiontimeScales=newTimeScaleCollection();timeScales.Add(newTimeScaleFixedInterval(SplitAppointmentCommandStep));returnnewSplitAppointmentOperation(SchedulerControl,timeScales,SchedulerControl.SelectedAppointments[0]);}}- Create a custom command class inherited from the command that you wish to replace.
- Override required methods of the command.
- Create a class that implements the
ISchedulerCommandFactoryServiceinterface. In this class, you need to implement theCreateCommandmethod to instantiate a custom command class. An identifier of the currently processed command is passed as a parameter of this method. - Use the custom class that implements the
ISchedulerCommandFactoryServiceinterface to substitute the default command service. In this case, the Scheduler control will use the custom command instead of the default command.
- CustomSchedulerCommandFactoryService.cs (VB: CustomSchedulerCommandFactoryService.vb)
- Form1.cs (VB: Form1.vb)
(you will be redirected to DevExpress.com to submit your response)