Skip to main content Skip to footer

Highlight Selected Appointment in C1Scheduler for Winforms

C1Scheduler for Winforms has been a popular control since the day it was introduced in the ComponentOne Winforms suite. With lots of user friendly features, it has successfully able to simulate the Microsoft Office Styling Scheduling functionalities for its users. One of the most popular feature for the users has been the ability to customize the Appointment appearance. This can be done with the help of the BeforeAppointmentFormat event which gives the flexibility to change the Appointment text, icons, backcolor. You can read more on this from this given Documentation link. In this blog, using this feature, we will implement a small custom requirement wherein user may want to highlight the currently selected Appointment. See the following code snippet for the implementation.


Private Sub C1Schedule1_BeforeAppointmentFormat(ByVal sender As Object, ByVal e As C1.Win.C1Schedule.BeforeAppointmentFormatEventArgs) Handles C1Schedule1.BeforeAppointmentFormat  
   If C1Schedule1.SelectedAppointments.Contains(e.Appointment) Then  
       e.BackColor = Color.Blue  
   Else  
       e.BackColor = e.Appointment.Label.Color  
   End If  
End Sub  

Private Sub C1Schedule1_SelectedAppointmentsChanged(ByVal sender As Object, ByVal e As C1.Win.C1Schedule.SelectedAppointmentsChangedEventArgs) Handles C1Schedule1.SelectedAppointmentsChanged  
   For Each app As Appointment In C1Schedule1.DataStorage.AppointmentStorage.Appointments  
       If C1Schedule1.SelectedAppointments.Contains(app) Then  
          app.Tag = "change"  
       Else  
          app.Tag = Nothing  
       End If  
   Next  
End Sub  

Download the attached samples for complete implementation. Download C# Sample Download VB.Net Sample

MESCIUS inc.

comments powered by Disqus