New to Telerik UI for WinForms? Start a free 30-day trial
Appointment Factory
Updated over 6 months ago
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:
C#
public class CustomAppointmentFactory : IAppointmentFactory
{
public IEvent CreateNewAppointment()
{
return new AppointmentWithEmail();
}
}
Then, you need to apply this factory to your RadScheduler:
C#
this.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.