Overview

This topic covers the specific events exposed by the RadScheduleView control and its sub element Appointment. The events are first grouped by control and then by their general purpose.

RadScheduleView provides a couple of useful events that can be used for customization purposes. Events can be used for: persisting appointment changes, creating new appointments or canceling various operations.

Event naming convention is the standard naming convention for data manipulation events similar to web and windows programming. Every operation has a before event (ending with -ing) and after event (ending with -ed). An example of these are AppointmentDeleting and AppointmentDeleted event of RadScheduleView.

All event arguments of the before operation events (ending with -ing) derive from the CancelRoutedEventArgs class. That's why all of the before operation events (ending with -ing) can be canceled by setting event arguments' Cancel property to True.

All event arguments of the after operation events (ending with -ed) derive directly from the RadRoutedEventArgs class.

Data Events

RadScheduleView exposes the following events regarding the data manipulation:

  • AppointmentCreating - occurs when an appointment is going to be created and just before the edit appointment dialog is shown. The AppointmentCreating event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An AppointmentCreatingEventArgs object. Via the AppointmentCreatingEventArgs you can access the following properties:

      • Appointment - gets the newly created appointment. This property is read-only and you can use it to initialize the appointment.

      • Cancel - set this boolean property to True, when you want to cancel the event.

  • AppointmentCreated - occurs when the new appointment is created. The AppointmentCreated event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An AppointmentCreatedEventArgs object. Via the AppointmentCreatedEventArgs you can access the following properties:

      • CreatedAppointment - this is the newly created appointment, initialized with its default values. The property is read-only.
  • AppointmentEditing - occurs when the appointment edit command is initialized and the edit appointment dialog window is about to be shown. The AppointmentEditing event handler receives two arguments:

    1. The sender argument contains the RadRadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An AppointmentEditingEventArgs object. Via the AppointmentEditingEventArgs you can access the following properties:

      • Appointment - gets the appointment that is going to be edited. This property is read-only.

      • Occurrence - gets the occurrence that is going to be edited. If the appointment is not recurrent, the value is null.

      • IsDeleted - true when an occurrence of a recurrent appointment is about to be deleted, false in all other cases.

      • Cancel - set this boolean property to True, when you want to cancel the event.

  • AppointmentEdited - occurs when the appointment edit has finished and the appointment changes are applied. The AppointmentEdited event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An AppointmentEditedEventArgs object. Via the AppointmentEditedEventArgs you can access the following properties:

      • Appointment - gets the appointment that is edited. This property is read-only.
  • AppointmentDeleting - occurs when the appointment is going to be removed from the data source. The AppointmentDeleting event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An AppointmentDeletingEventArgs object. Via the AppointmentDeletingEventArgs you can access the following properties:

      • Appointment - gets the appointment that is going to be deleted. This property is read-only.

      • Cancel - set this boolean property to True, when you want to cancel the event.

  • AppointmentDeleted - occurs when the appointment has been removed from the data source. The AppointmentDeleted event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An AppointmentDeletedEventArgs object. Via the AppointmentDeletedEventArgs you can access the following properties:

      • Appointment - gets the appointment that is deleted. This property is read-only.
  • AppointmentSaving - occurs before the appointment is saved. The AppointmentCreating event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An AppointmentSavingEventArgs object. Via the AppointmentSavingEventArgs you can access the following property:

      • Appointment - gets the appointment that is going to be saved. This property is read-only.

      • Cancel - set this boolean property to True, when you want to cancel the event.

When a new appointment is created the lifecycle of the raised events is: 1. AppointmentCreating 2. AppointmentSaving 3. AppointmentCreated

When an existing appointment is edited the lifecycle of the raised events is: 1. AppointmentEditing 2. AppointmentSaving 3. AppointmentEdited

When an existing appointment is deleted the lifecycle of the raised events is: 1. AppointmentDeleting 2. AppointmentDeleted Note that when deleting an appointment, the AppointmentSaving event is not raised.

When an existing occurrence is deleted the lifecycle of the raised events is: 1. AppointmentEditing 2. AppointmentSaving 3. AppointmentEdited

Other Events

  • AppointmentSelectionChanged - occurs when an appointments is selected.

  • ShowDialog - occurs when a ScheduleView dialog is about to be shown. The ShowDialog event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An ShowDialogEventArgs object. Via the ShowDialogEventArgs you can access the following properties:

      • DialogViewModel - gets the scheduler dialog. The property can be cast to the following types:

        1. AppointmentDialogViewModel

        2. RecurrenceChoiceDialogViewModel

        3. RecurrenceDialogViewModel

        4. ConfirmDialogViewModel

      • Cancel - set this boolean property to True, when you want to cancel the event.

      • DefaultDialogResult - set this property to True when you want to simulate pressing OK in the corresponding window, or False if you want to simulate pressing Cancel.

  • VisibleRangeChanged - occurs when the view or the Start/End date is changed. The VisibleRangeChanged event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An EventArgs object.

  • DialogClosing - occurs when a ScheduleView dialog is about to be closed. The DialogClosing event handler receives two arguments:

    1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type.

    2. An CancelRoutedEventArgs object. After casting the CancelRoutedEventArgs to CloseDialogEventArgs you can access the following properties:

      • DialogViewModel - gets the scheduler dialog. The property can be cast to the following types:

        1. AppointmentDialogViewModel

        2. RecurrenceChoiceDialogViewModel

        3. RecurrenceDialogViewModel

        4. ConfirmDialogViewModel

    3. Cancel - set this boolean property to True, when you want to cancel the event.

private void ScheduleView_DialogClosing(object sender, CancelRoutedEventArgs e) 
{ 
    // cast to CloseDialogEventArgs 
    var eventArgs = e as CloseDialogEventArgs; 
 
    // you can get the DialogViewModel 
    var currentDialogViewModel = eventArgs.DialogViewModel; 
 
    // you can also cancel the event 
    eventArgs.Cancel = true; 
} 

See Also

In this article