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

Problems with editing custom recurring appointments

Hello
Editing custom recurring appointments doesn't seem to work.

For example, I changed the CustomizationDemo to have one of the appointments recurring, like this:

var xdate = DateTime.Today.AddDays(-3) ;
            RecurrenceProperties RecProp = new RecurrenceProperties();
            RecProp.RecurrenceType = RecurrenceType.Daily;
            RecProp.IsDailyEveryNDays = true;
            RecProp.DailyNDays = 1;
            RecProp.IsRangeRecurrenceCount = true;
            RecProp.IsRangeNoEndDate = false;
            RecProp.IsRangeEndDate = false;
            RecProp.RangeRecurrenceCount = 15;
            var recRule = ScheduleHelper.RRuleGenerator(RecProp, xdate, xdate.AddDays(13));
            AppCollection.Add(new Appointment()
            {
                AppointmentImageURI = new BitmapImage(new Uri("pack://application:,,,/CustomizationDemo;Component/Assets/Team.png")),
                AppointmentType = Appointment.AppointmentTypes.Office,
                Status = Schedule.AppointmentStatusCollection[0],
                StartTime = xdate.AddHours(10),
                EndTime = xdate.AddHours(12),
                AppointmentTime = xdate.AddHours(10).ToString("hh:mm tt"),
                Subject = "TESTMeeting",
                AppointmentBackground = new SolidColorBrush(Color.FromArgb(255, 60, 181, 75)),
                RecurrenceRule = recRule,
                IsRecursive  = true
            }
            );

1. problem
When I run the demo, it correctly shows custom appointments. However, when I edit recurring appointment, click 'The entire series', change the Subject and save, the Schedule control still shows the old Subject (in this case 'TESTMeeting'). How to show updated properties in the SfSchedule when using custom appointment type?

2. problem
When I click on an recurring appointment, and click on 'Just this one' the program breaks in EditAppointment (which is called from the editButton_Click event handler) method with NullReferenceException, because the property AddDataContext.Appointment is not the custom Appointment type, but ScheduleAppointment. How to receive correct object type in this event handler (this problem also occurs in AppointmentEditorClosed event handler)?

Thanks, Tom

1 Reply

AS Arun siva Syncfusion Team January 11, 2019 01:12 PM UTC

Hi Tomislav Tustonic, 
 
Thanks for contacting Syncfusion support, 
 
Query 1: Recurrence appointment collection doesn’t update based on the property changed in appointment editor 
In the customization sample, we have created a custom appointment editor for edit and update the appointments, in case of handling recurrence appointments, you need to handle the same in sample level to modify all the appointments based on the appointment editor. 
 
Query 2: How to get the custom appointment in the event handler 
 You can get the custom appointment of schedule in the event handler in sample level by using ObjectID property of appointment, there is a workaround for this, we have prepared a simple sample for the same.  
 
C# 
private object GetCustomAppointment(object originalSource) 
        { 
            var selectedAppointment = (originalSource as FrameworkElement).DataContext as ScheduleAppointment; 
            var recurringAppointment = schedule.Appointments.FirstOrDefault(appointment => appointment.IsRecursive && appointment.RecurrenceID == selectedAppointment.RecurrenceID); 
 
            var source = (IEnumerable<object>)schedule.ItemsSource; 
            if (recurringAppointment != null) 
                return source.FirstOrDefault(x => x.GetHashCode() == (int)recurringAppointment.ObjectID); 
 
            return null; 
        } 
 
Sample: Schedule 
 
Kindly revert us if you have any concern. 
 
Regards, 
Arun Siva R 


Loader.
Live Chat Icon For mobile
Up arrow icon