Articles in this section
Category / Section

How to add additional attributes for your appointments ?

1 min read

 

In SfSchedule, you can add additional attributes for your appointments. You need to create a separate class which inherits from ScheduleAppointment and include required properties in this class for adding additional attribute to appointment. In this section, additional attribute (Appointment ID) is added to an appointment.

 

C#

        
    public class CustomAppointment : ScheduleAppointment
    {
        private string appointment_ID;
        public string AppointmentID
        {
            get { return appointment_ID; }
            set { appointment_ID = value; }
        } 
    }
 

 

C#

            
            public ObservableCollection<CustomAppointment> appointmentCollection { get ; set; }
     
           public ScheduleViewModel()
           {
            CustomAppointment  scheduleAppointment = new CustomAppointment();
            scheduleAppointment.Subject = "Meeting";            scheduleAppointment.AppointmentID = "579";
            scheduleAppointment.Color = Color.Green;
            scheduleAppointment.StartTime = DateTime.Now.Date.AddHours(10);
            scheduleAppointment.EndTime = DateTime.Now.Date.AddHours(12);
            AppointmentCollection = new ObservableCollection<CustomAppointment>();
            AppointmentCollection.Add(scheduleAppointment);
           } 
   
 

 

XAML

  
     <syncfusion:SfSchedule
       x:Name="schedule" ScheduleView="WeekView" 
       DataSource = "{Binding AppointmentCollection}" 
       HorizontalOptions="FillAndExpand"  
       VerticalOptions="FillAndExpand" >
      </syncfusion:SfSchedule>
 

 

 

In the CellTapped event of Schedule, you can get the appointment information along with additional attribute included in the argument of the event.

 

 

            
         schedule.CellTapped += CellTappedEventHandler;
 
        void CellTappedEventHandler(object sender, CellTappedEventArgs e)
        {
           var appointment = e.Appointment as CustomAppointment;
           if(appointment != null && appointment.Subject == "Meeting")
                DisplayAlert("Appointment details", appointment.AppointmentID, "ok");
        }
 

 

You can download the complete project from here ScheduleSample.

 

The following screenshot displays the output of the mentioned project.

 

added additional attributes in Schedular

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied