Category / Section
How to change the marker color of the appointments in WinForms ScheduleControl?
1 min read
Customize the marker color of appointments
To customize the marker color of appointments, override the GetMarkers method of ScheduleDataProvider and define the list of markers with the required color.
C#
public class SimpleScheduleDataProvider : ScheduleDataProvider { ListObjectList markerList; /// <summary> /// Get the markers for appointments /// </summary> /// <returns></returns> public override ILookUpObjectList GetMarkers() { return MarkerLists(); } /// <summary> /// Set the marker color for appointments. /// </summary> /// <returns></returns> private ListObjectList MarkerLists() { markerList = new ListObjectList(); markerList.Add(new ListObject(0, "InProgress", Color.FromArgb(50, Color.Yellow))); ////same as noMarkColor markerList.Add(new ListObject(1, "Done", Color.Green)); markerList.Add(new ListObject(2, "Busy", Color.Violet)); markerList.Add(new ListObject(3, "Out of Office", Color.Tomato)); return markerList; } }
VB
Public Class SimpleScheduleDataProvider Inherits ScheduleDataProvider Private markerList As ListObjectList ''' <summary> ''' Get the markers for appointments ''' </summary> ''' <returns></returns> Public Overrides Function GetMarkers() As ILookUpObjectList Return MarkerLists() End Function ''' <summary> ''' Set the marker color for appointments. ''' </summary> ''' <returns></returns> Private Function MarkerLists() As ListObjectList markerList = New ListObjectList() markerList.Add(New ListObject(0, "InProgress", Color.FromArgb(50, Color.Yellow))) '//same as noMarkColor markerList.Add(New ListObject(1, "Done", Color.Green)) markerList.Add(New ListObject(2, "Busy", Color.Violet)) markerList.Add(New ListObject(3, "Out of Office", Color.Tomato)) Return markerList End Function End Class
Screenshot
Sample links: