Skip to main content
A newer version of this page is available. .

How to: Create a Custom Appointment Recurrence Form (Method 1)

  • 4 minutes to read

This document describes how to create a custom form and replace the standard appointment recurrence editing form with a newly created form. Method 1 uses the AppointmentRecurrenceForm descendant. Use this technique to modify the default form layout or the form’s behavior.

The following example illustrates how you can customize the default recurrence dialog by changing captions and initializing editors.

CustomRecurrenceForm

Create an AppointmentRecurrenceForm descendant. Use the default constructor code to perform required initialization for the editors located on the form.

Default recurrence form is invoked from the AppointmentForm by clicking the Recurrence button.

To invoke a custom recurrence dialog instead of a default one, create an AppointmentForm descendant. Override the CreateAppointmentRecurrenceForm method with the code that creates a custom recurrence form. It is necessary because the AppointmentRecurrenceForm constructor requires an AppointmentFormController instance, which is accessible within the AppointmentForm class scope.

Handle the SchedulerControl.EditAppointmentFormShowing event, to substitute a default appointment form with a custom one.

The example calls the SchedulerControl.CreateAppointment method with parameters required to invoke the recurrence appointment dialog.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CustomRecurrenceFormDescendantSample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            this.schedulerControl1.EditAppointmentFormShowing += schedulerControl1_EditAppointmentFormShowing;
            this.Shown += Form1_Shown;
        }

        void schedulerControl1_EditAppointmentFormShowing(object sender, DevExpress.XtraScheduler.AppointmentFormEventArgs e)
        {
            // Recurrence form allows editing only daily recurring appointments. 
            MyAppointmentEditForm myForm = new MyAppointmentEditForm(schedulerControl1,
                e.Appointment, e.OpenRecurrenceForm, DevExpress.XtraScheduler.RecurrenceType.Daily);
            myForm.ShowDialog();
            e.Handled = true;

        }

        void Form1_Shown(object sender, EventArgs e)
        {
            this.schedulerControl1.CreateAppointment(false, true);
        }
    }
}