Commands
RadScheduler exposes its functionality through various commands that can be executed on its behalf. All commands are placed in the static class RadSchedulerCommands. The purpose of this tutorial is to show you all of the commands exposed by the RadSchedulerCommands class and how to execute them.
CreateAppointment / CreateAppointmentWithDialog Commands
When you want to create a new appointment and show the EditAppointmentDialog, then you need to use the CreateAppointment or CreateAppointmentWithDialog commands. If no parameter is passed, the SelectedSlot of RadScheduler will be used for the new appointment start and end dates. If you want to explicitly specify which will be the start and end date you should pass a parameter of type IDateSpan (for example Slot is an IDateSpan).
The difference between both commands is when neither the parameter nor the SelectedSlot is set. In this case only the CreateAppointmentWithDialog command will show EditAppointmentDialog for the first visible slot, while CreateAppointment command won’t be executed.
RadSchedulerCommands.CreateAppointment.Execute(null, this.MyScheduler);
RadSchedulerCommands.CreateAppointmentWithDialog.Execute(null, this.MyScheduler);
CreateInlineAppointment Command
Use it when you want to create a new appointment via the inline editing. If no parameter is passed, the SelectedSlot of RadScheduler will be used for the new appointment start and end dates. If you want to explicitly specify which will be the start and end date you should pass a parameter of type IDateSpan (for example Slot is an IDateSpan):
RadSchedulerCommands.CreateInlineAppointment.Execute(null, this.MyScheduler);
IsInlineEditingEnabled property of the RadScheduler should be set in order to use the command.
EditAppointment Command
Use it when you want to show the edit dialog for an appointment. If no parameters are passed it uses the SelectedAppointment of RadScheduler. By default this command is bound to double click on appointment.
RadSchedulerCommands.EditAppointment.Execute(null, this.MyScheduler);
DeleteAppointment Command
When you want to remove an appointment from AppointmentsSource collection, then you need to use the DeleteAppointment command. If no parameter is passed the SelectedAppointment will be used.
RadSchedulerCommands.DeleteAppointment.Execute(null, this.MyScheduler);
EditRecurrenceRule Command
When you want to open EditRecurrenceDialog, then you need to use the EditRecurrenceRule command. This command is used mainly in EditAppointmentDialog.
DeleteRecurrenceRule Command
When you want to remove the recurrence, then you need to use DeleteRecurrenceRule Command. The command is used mainly in EditRecurrenceDialog.
EditParentAppointment Command
If you want to edit the master appointment, when the user has initiated editing of an occurrence or exception from appointment's RecurrenceRule, you need to use the EditParentAppointment command. This command is used mainly in EditAppointmentDialog.
SetDayViewMode Command
Executing this command will result in setting the RadScheduler’s ActiveViewDefinition property to DayViewDefinition.
RadSchedulerCommands.SetDayViewMode.Execute(null, this.MyScheduler);
SetWeekViewMode Command
Executing this command will result in setting the RadScheduler's ActiveViewDefinition property to WeekViewDefinition.
RadSchedulerCommands.SetWeekViewMode.Execute(null, this.MyScheduler);
SetMonthViewMode Command
Executing this command will result in setting the RadScheduler's ActiveViewDefinition property to MonthViewDefinition.
RadSchedulerCommands.SetMonthViewMode.Execute(null, this.MyScheduler);
SetTimelineViewMode Command
Executing this command will result in setting the RadScheduler's ActiveViewDefinition property to TimelineViewDefinition.
RadSchedulerCommands.SetTimelineViewMode.Execute(null, this.MyScheduler);
IncreaseVisibleDateLarge / DecreaseVisibleDateLarge Commands
Increases/decreases the first visible date with n months or days, where n is the value of the LargeChangeInterval property of the ActiveViewDefinition. Executing this command is equivalent to changing the displayed days using the navigation buttons.
RadSchedulerCommands.IncreaseVisibleDateLarge.Execute(null, this.MyScheduler);
RadSchedulerCommands.DecreaseVisibleDateLarge.Execute(null, this.MyScheduler);
SetAppointmentImportance Command
When you want to set the Appointment's Importance property, then you need to execute the SetAppointmentImportance command. This command is used primely in EditAppointmentDialog.
GoToPreviousAppointment / GoToNextAppointment Commands
Use these commands when you want to navigate to the previous/next appointment outside the visible range:
RadSchedulerCommands.GoToPreviousAppointment.Execute(null, this.MyScheduler);
RadSchedulerCommands.GoToNextAppointment.Execute(null, this.MyScheduler);
SetToday Command
You can use the SetToday command to navigate to the current day in the active view definition.
RadSchedulerCommands.SetToday.Execute(null, this.MyScheduler);