Recurrence

Hello,
I am working with the sfsSchedule control and absolutely love it! For now, I am just importing appointments from Sqlite and I want to extend it to allow users to add recurrence to the imported appointments. Ive checked the code for UI Controls and Essential UI Kit but I cant find a form example of inputting recurrence. I know that it is very extensive with the options it provides so my question is...

Is there any example code of a UI for all the possibilities of recurrence? Or could one be made available? I think it would really be a great feature to show off in the Controls Explorer app.

I appreciate your time

5 Replies

SS SaiGanesh Sakthivel Syncfusion Team May 19, 2020 02:25 PM UTC

Hi John,  
  
Sorry for the Inconvenience caused.  
  
Currently we are analyzed the reported query with our development team. We need some more time to analyze our requirement and we will update the details on or before May 21,2020. We appreciate your patience until then.  
  
Regards,  
SaiGanesh Sakthivel


JE John Espinosa May 21, 2020 12:26 PM UTC

Ok great. Thank you


LN Lakshmi Natarajan Syncfusion Team May 22, 2020 10:28 AM UTC

Hi John, 
 
Thank you for your patience. 
 
We have checked the reported query “Add recurrence to the appointments” from our end. We would like to inform that you can achieve your requirement using CellTapped event in Schedule. To achieve this, you need to follow the below mentioned steps. 
 
Step 1: Create schedule and editor layout with in a container  
XAML 
<Grid x:Name="grid_layout"> 
            <syncfusion:SfSchedule 
                x:Name="schedule" 
                ScheduleView="WeekView"  
                DataSource="{Binding ListOfMeeting}"  
                ShowAppointmentsInline="True" 
                HorizontalOptions="FillAndExpand" 
                VerticalOptions="FillAndExpand" > 
                <syncfusion:SfSchedule.BindingContext> 
                    <local:AppointmentEditorViewModel/> 
                </syncfusion:SfSchedule.BindingContext> 
            </syncfusion:SfSchedule> 
            <local:EditorLayout  x:Name="editorLayout" IsVisible= "false" /> 
        </Grid> 
 
Step 2: Design your own recurrence appointment editor with the required fields. 
 
Step 3: Open the editor on the Schedule.CellTapped event and add condition to check, that the selected cell contains appointment or not, to confirm the required action is to either edit or create the appointment. 
C# 
private void CellTappedEventHandler(object sender, CellTappedEventArgs e) 
        { 
            schedule.IsVisible = false; 
            editorLayout.IsVisible = true; 
            if (schedule.ScheduleView == ScheduleView.MonthView) 
            { 
                //create Appointment 
                (editorLayout.Behaviors[0] as EditorLayoutBehavior).OpenEditor(null, e.Datetime); 
 
                isNewAppointment = true; 
            } 
            else 
            { 
                if (e.Appointment != null) 
                { 
                    ObservableCollection<ScheduleAppointment> appointment = new ObservableCollection<ScheduleAppointment>(); 
                    appointment = (ObservableCollection<ScheduleAppointment>)schedule.DataSource; 
                    indexOfAppointment = appointment.IndexOf((ScheduleAppointment)e.Appointment); 
                    (editorLayout.Behaviors[0] as EditorLayoutBehavior).OpenEditor((ScheduleAppointment)e.Appointment, e.Datetime); 
                    isNewAppointment = false; 
                } 
                else 
                { 
                    //create Appointment 
                    (editorLayout.Behaviors[0] as EditorLayoutBehavior).OpenEditor(null, e.Datetime); 
                    isNewAppointment = true; 
                } 
 
            } 
        } 
 
Step 4: Update the editor fields based on the selected cell details 
C# 
private void UpdateEditor() 
        { 
            if (selectedAppointment != null) 
            { 
                eventNameText.Text = selectedAppointment.Subject; 
                startDatePicker.Date = selectedAppointment.StartTime; 
                endDatePicker.Date = selectedAppointment.EndTime; 
                occurrenceButton.Text = (listLayout.Behaviors[0] as ListBehavior).repeatButton.Text; 
                location.Text = selectedAppointment.Location; 
                notes.Text = selectedAppointment.Notes; 
                selectedAppointment.RecurrenceRule = (listLayout.Behaviors[0] as ListBehavior).SelectedAppointment.RecurrenceRule; 
 
                if (!selectedAppointment.IsAllDay) 
                { 
                    startTimePicker.Time = new TimeSpan(selectedAppointment.StartTime.Hour, selectedAppointment.StartTime.Minute, selectedAppointment.StartTime.Second); 
                    endTimePicker.Time = new TimeSpan(selectedAppointment.EndTime.Hour, selectedAppointment.EndTime.Minute, selectedAppointment.EndTime.Second); 
                    switchAllDay.IsToggled = false; 
                } 
                else 
                { 
                    startTimePicker.Time = new TimeSpan(12, 0, 0); 
                    startTimePicker.IsEnabled = false; 
                    endTimePicker.Time = new TimeSpan(12, 0, 0); 
                    endTimePicker.IsEnabled = false; 
                    switchAllDay.IsToggled = true; 
                } 
            } 
            else 
            { 
                eventNameText.Text = ""; 
                switchAllDay.IsToggled = false; 
                startDatePicker.Date = selectedDate; 
                startTimePicker.Time = new TimeSpan(selectedDate.Hour, selectedDate.Minute, selectedDate.Second); 
                endDatePicker.Date = selectedDate; 
                endTimePicker.Time = new TimeSpan(selectedDate.Hour + 1, selectedDate.Minute, selectedDate.Second); 
                occurrenceButton.Text = "Do not repeat"; 
                location.Text = ""; 
                notes.Text = ""; 
                if ((listLayout.Behaviors[0] as ListBehavior).SelectedAppointment != null) 
                { 
                    selectedAppointment.RecurrenceRule = (listLayout.Behaviors[0] as ListBehavior).SelectedAppointment.RecurrenceRule; 
                } 
            } 
        } 
 
Step 5: Set recurrence rule based on the updated field. 
 
We have prepared the sample to add recurrence to the appointments in the following link, 
 
Please refer below UG link for more detail about recurrence appointment in schedule. 
 
Regards, 
Lakshmi Natarajan 



JE John Espinosa May 22, 2020 02:03 PM UTC

This is perfect! Lakshmi thank you for this example. This is exactly what I was looking for!


LN Lakshmi Natarajan Syncfusion Team May 25, 2020 03:28 AM UTC

Hi John, 
 
Thank you for the update. 
 
We are glad that our solution meets your requirement. Please let us know if you need any further update. As always we are happy to help you out. 
 
Lakshmi Natarajan 
 


Loader.
Up arrow icon