New to Telerik UI for WinForms? Download free 30-day trial

Appointment Factory

RadScheduler uses an AppointmentFactory to create IEvent objects which represent the appointments. It implements the IAppointmentFactory interface which requires only the CreateNewAppointment method's implementation.

This factory is very useful when you need to use a custom Appointment class. Just override the CreateNewAppointment method and run a new instance of your custom class:


public class CustomAppointmentFactory : IAppointmentFactory
{
    public IEvent CreateNewAppointment()
    {
        return new AppointmentWithEmail();
    }
}

Public Class CustomAppointmentFactory
Implements IAppointmentFactory
    Public Function CreateNewAppointment() As IEvent Implements IAppointmentFactory.CreateNewAppointment
        Return New AppointmentWithEmail()
    End Function
End Class

Then, you need to apply this factory to your RadScheduler:

this.radScheduler1.AppointmentFactory = new CustomAppointmentFactory();

Me.RadScheduler1.AppointmentFactory = New CustomAppointmentFactory()

Now, if you double click a SchedulerCellElement or create a new appointment via the context menu, the custom class for appointments will be used.

See Also

In this article