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

Resize Appointments

Hi,

How do we resize appointments to span multiple days? Could you please provide a sample application to explain the same.

Thanks,
Mohit Saxena

5 Replies

MG Mohanraj Gunasekaran Syncfusion Team July 28, 2017 10:30 AM UTC

Hi Mohit,   
   
Thanks for using Syncfusion product.   
   
In order to span the appointment for multi days, you can use the ArrayListDataProvider as a Datasource and use the ShowMultiDayAppointmentsAsSpans properties. Please refer to the below code example.   
   
Code example   
ArrayListDataProvider scheduleProvider;   
scheduleProvider = new SimpleArrayListProvider();   
scheduleProvider.MasterList =SimpleArrayListProvider.InitializeRandomData();   
this.scheduleControl1.DataSource = scheduleProvider;   
   
//Default value is true.   
this.scheduleControl1.ShowMultiDayAppointmentsAsSpans =true;   
   
 
  
 
 
Screenshot 
 
 
Sample link: ScheduleControl 
 
Please let us know if we misunderstood your scenario. 
 
Regards, 
Mohanraj G 
 



MO Mohit July 28, 2017 10:40 AM UTC

Hi,

Actually, I want to resize appointment to span multiple days using mouse.


Thanks,

Mohit




MG Mohanraj Gunasekaran Syncfusion Team July 31, 2017 11:31 AM UTC

Hi Mohit,  
 
Thanks for using Syncfusion product.  
 
Currently, ScheduleControl does not have the Resizing support for appointments. So, we have logged the feature report for this. It will be available on any of our upcoming release.  
 
Regards,  
Mohanraj G  



CA Carlos June 4, 2018 03:18 PM UTC

Hi:

I'm using the schedule control in windows forms and I have been able to verify that when there are several multi days appointments in a month, it only shows one of these appointments. I am using version 16.1.0.37 of this control.
Could you please provide a sample application that works? The example above does not work.

Thanks



SN Sindhu Nagarajan Syncfusion Team June 5, 2018 01:07 PM UTC

Hi Carlos, 
 
Sorry for the inconvenience caused. 
 
If you want to add an appointment for multi days, you can use SimpleScheduleDataProvider as datasource to the schedule control. We have prepared a simple sample as per your requirement. In the sample,  GetSchedule() method is overridden. By overriding the method, the appointment will be generated individually  for the days from StartDate to the End Date. Please refer to the below code and sample, 
 
Code Example 
public override IScheduleAppointmentList GetSchedule(System.DateTime startDate, System.DateTime endDate) 
{ 
     ScheduleAppointmentList list = new ScheduleAppointmentList(); 
     System.DateTime start = startDate.Date; 
     System.DateTime end = endDate.Date; 
 
     if (ScheduleList != null && ScheduleList.Count > 0) 
     { 
         return list; 
     } 
 
     foreach (ScheduleAppointment item in this.MasterList) 
     { 
         if ((item.StartTime.Date >= start && item.StartTime.Date <= end) || (item.EndTime.AddMinutes(-1).Date > start && item.EndTime.Date <= end)) 
         { 
             if (item.StartTime < item.EndTime) 
             { 
                 int count = ((TimeSpan)(item.EndTime.Date - item.StartTime.Date)).Days + 1; 
                 System.DateTime meanDate = DateTime.Now; 
                 System.DateTime meanStartDate = DateTime.Now; 
                 System.DateTime tempEndTime = DateTime.Now; 
                 bool intialized = true; 
 
                 for (int i = 0; i < count; i++) 
                 { 
                     IScheduleAppointment item1 = item.Clone() as IScheduleAppointment; 
                     if (intialized) 
                     { 
                         meanStartDate = item.StartTime; 
                         meanDate = item.EndTime.Date; 
                         tempEndTime = item.EndTime; 
                         intialized = false; 
                     } 
                     else 
                     { 
                         item1.StartTime = meanStartDate.AddDays(i).Date; 
                     } 
                     if (item.StartTime.Date < meanDate) 
                     { 
                         item1.EndTime = item1.StartTime.Date; 
                     } 
                     else if (item.StartTime.Date.Equals(meanDate)) 
                     { 
                         item1.EndTime = tempEndTime; 
                     } 
                     list.Add(item1); 
                 } 
             } 
             else 
             { 
                 list.Add(item); 
             } 
         } 
     } 
     list.SortStartTime(); 
     ScheduleList = list; 
     return list; 
} 
 
Screenshot 
 
 
Sample Link: ScheduleControl 
 
Please let us know if you have any other queries. 
 
Regards, 
Sindhu  


Loader.
Live Chat Icon For mobile
Up arrow icon