We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add multi span appointment in WinForms ScheduleControl?

Platform: WinForms |
Control: ScheduleControl |
Published Date: September 21, 2018 |
Last Revised Date: January 9, 2020
Tags: appointments

Add multi span appointment

To add span appointments in the ScheduleControl, use ArrayListDataProvider as a binding source of the ScheduleControl. To add multi span appointments, use the AddSpanAppointment method.

 

C#

ArrayListDataProvider dataprovider = new Syncfusion.Schedule.ArrayListDataProvider();
IScheduleAppointment appointment = dataprovider.NewScheduleAppointment();
 
appointment = dataprovider.NewScheduleAppointment();
appointment.StartTime = DateTime.Now;
appointment.EndTime = DateTime.Now.AddDays(4);
appointment.AllDay = true;
appointment.Subject = "Party";
appointment.LabelValue = 1;
appointment.AllowResize = false;
appointment.AllowDrag = false;
 
//Convert the appointment as the recurrence schedule appointment    
IRecurringScheduleAppointment recurrenceAppointment = appointment as IRecurringScheduleAppointment;
 
IScheduleAppointment appointment2 = dataprovider.NewScheduleAppointment();
 
appointment2 = dataprovider.NewScheduleAppointment();
appointment2.StartTime = DateTime.Now.AddDays(6);
appointment2.EndTime = DateTime.Now.AddDays(8);
appointment2.AllDay = true;
appointment2.Subject = "Meeting";
appointment2.LabelValue = 3;
appointment2.AllowResize = false;
appointment2.AllowDrag = false;
 
//Convert the appointment as the recurrence schedule appointment    
IRecurringScheduleAppointment recurrenceAppointment2 = appointment2 as IRecurringScheduleAppointment;
 
//Add the multi-span day appointment to the schedule control   
this.scheduleControl1.AddSpanAppointment(recurrenceAppointment, dataprovider);
this.scheduleControl1.AddSpanAppointment(recurrenceAppointment2, dataprovider);
this.scheduleControl1.DataSource = dataprovider;

VB

Dim dataprovider As ArrayListDataProvider = New Syncfusion.Schedule.ArrayListDataProvider()
Dim appointment As IScheduleAppointment = dataprovider.NewScheduleAppointment()
 
appointment = dataprovider.NewScheduleAppointment()
appointment.StartTime = DateTime.Now
appointment.EndTime = DateTime.Now.AddDays(4)
appointment.AllDay = True
appointment.Subject = "Party"
appointment.LabelValue = 1
appointment.AllowResize = False
appointment.AllowDrag = False
 
'Convert the appointment as the recurrence schedule appointment    
Dim recurrenceAppointment As IRecurringScheduleAppointment = TryCast(appointment, IRecurringScheduleAppointment)
 
Dim appointment2 As IScheduleAppointment = dataprovider.NewScheduleAppointment()
 
appointment2 = dataprovider.NewScheduleAppointment()
appointment2.StartTime = DateTime.Now.AddDays(6)
appointment2.EndTime = DateTime.Now.AddDays(8)
appointment2.AllDay = True
appointment2.Subject = "Meeting"
appointment2.LabelValue = 3
appointment2.AllowResize = False
appointment2.AllowDrag = False
 
'Convert the appointment as the recurrence schedule appointment    
Dim recurrenceAppointment2 As IRecurringScheduleAppointment = TryCast(appointment2, IRecurringScheduleAppointment)
 
'Add the multi-span day appointment to the schedule control   
Me.scheduleControl1.AddSpanAppointment(recurrenceAppointment, dataprovider)
Me.scheduleControl1.AddSpanAppointment(recurrenceAppointment2, dataprovider)
Me.scheduleControl1.DataSource = dataprovider
 

 

Screenshot

Show the multi span appointments

Sample Links:

CSC#: MutiSpan Appointment

VB: MultiSpan Appointment

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile