)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the appointments label color in WinForms ScheduleControl?

Platform: WinForms |
Control: ScheduleControl |
Published Date: January 12, 2018 |
Last Revised Date: January 9, 2020

Customize the appointments label color

In order to customize the label color of the appointments, Initlists and GetLabels methods can be customized in custom ScheduleDataProvider class. In InitLists method, required number of labels can be added with different colors.

C#

public class SimpleScheduleDataProvider : ScheduleDataProvider
{   
    public override ILookUpObjectList GetLabels()
    {
        return list;
    }   
    public override void InitLists()
    {
        list = new ListObjectList();
        list.Add(new ListObject(0, "None", Color.Black));
        list.Add(new ListObject(1, "Important", Color.Red));
        list.Add(new ListObject(2, "Business", Color.Purple));
        list.Add(new ListObject(3, "Personal", Color.Tomato));
        list.Add(new ListObject(4, "Vacation", Color.Pink));
        list.Add(new ListObject(5, "Must Attend", Color.YellowGreen));
        list.Add(new ListObject(6, "Travel Required", Color.Violet));
        list.Add(new ListObject(7, "Needs Preparation", Color.Tomato));
        list.Add(new ListObject(8, "Birthday", Color.SpringGreen));
        list.Add(new ListObject(9, "Anniversary", Color.DarkMagenta));
        list.Add(new ListObject(10, "Phone Call", Color.RosyBrown));
        list.Add(new ListObject(11, "Marriage", Color.Aqua));
    }
}

 

VB

Public Class SimpleScheduleDataProvider
    Inherits ScheduleDataProvider
    Public Overrides Function GetLabels() As ILookUpObjectList
        Return list
    End Function
    Public Overrides Sub InitLists()
        list = New ListObjectList()
        list.Add(New ListObject(0, "None", Color.Black))
        list.Add(New ListObject(1, "Important", Color.Red))
        list.Add(New ListObject(2, "Business", Color.Purple))
        list.Add(New ListObject(3, "Personal", Color.Tomato))
        list.Add(New ListObject(4, "Vacation", Color.Pink))
        list.Add(New ListObject(5, "Must Attend", Color.YellowGreen))
        list.Add(New ListObject(6, "Travel Required", Color.Violet))
        list.Add(New ListObject(7, "Needs Preparation", Color.Tomato))
        list.Add(New ListObject(8, "Birthday", Color.SpringGreen))
        list.Add(New ListObject(9, "Anniversary", Color.DarkMagenta))
        list.Add(New ListObject(10, "Phone Call", Color.RosyBrown))
        list.Add(New ListObject(11, "Marriage", Color.Aqua))
    End Sub

Screenshot:

Customize the appointments label color

Samples:

C#: Customizing Labelcolor_CS

VB: Customizing Labelcolor_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
Peregrino
Jul 16, 2020

I think we also need to note that the first list item value must start with zero. Otherwise, we did encounter an exception.

Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon