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. Image for the cookie policy date

Custom Appointment BackColor

Hello! I'm really enjoying the product, but I have a question: How do I set a custom color for Schedule Appointment items ?, I already use the values of item.LabelValue = 2; but I want to customize with any color system color, for example: item.LabelValue = Color.Tomato. I already tried the item.BackColor = Color.Tomato, but without any result. 

Thaks in advance!

3 Replies

MG Mohanraj Gunasekaran Syncfusion Team September 11, 2017 11:42 AM UTC

Hi Ary, 

Thanks for your interest in Syncfusion products.  
We could able to understand your scenario and created the simple sample based your requirement. In order to change the label colors, use the custom ScheduleDataProvider and override the InitLists method. In that method, you can change the LabelValue colors to change the appointment backColor. Please make use of the below code,  
Code snippet:  
public class SimpleScheduleDataProvider : ScheduleDataProvider  
    /// <summary>  
    /// Default constructor.  
    /// </summary>  
    public SimpleScheduleDataProvider()  
        : base()  
    public override void InitLists()  
        ///Suggestion 1  
        this.LabelList[0].ColorMember = Color.Black;  
        this.LabelList[1].ColorMember = Color.Red;  
        this.LabelList[2].ColorMember = Color.Purple;  
        this.LabelList[3].ColorMember = Color.Yellow;  
        this.LabelList[4].ColorMember = Color.Pink;  
        this.LabelList[5].ColorMember = Color.YellowGreen;  
        this.LabelList[6].ColorMember = Color.Violet;  
        this.LabelList[7].ColorMember = Color.Tomato;  
        this.LabelList[8].ColorMember = Color.SpringGreen;  
        this.LabelList[9].ColorMember = Color.SandyBrown;  
        this.LabelList[10].ColorMember = Color.RosyBrown;  
        ///Suggestion 2  
        //this.LabelList = new ListObjectList();  
        //this.LabelList.Add(new ListObject(0, "None", Color.White));  
        //this.LabelList.Add(new ListObject(1, "Important", Color.Red));  
        //this.LabelList.Add(new ListObject(2, "Business", Color.Purple));  
        //this.LabelList.Add(new ListObject(3, "Personal", Color.Yellow));  
        //this.LabelList.Add(new ListObject(4, "Vacation", Color.Pink));  
        //this.LabelList.Add(new ListObject(5, "Must Attend", Color.YellowGreen));  
        //this.LabelList.Add(new ListObject(6, "Travel Required", Color.Violet));  
        //this.LabelList.Add(new ListObject(7, "Needs Preparation", Color.Tomato));  
        //this.LabelList.Add(new ListObject(8, "Birthday", Color.SpringGreen));  
        //this.LabelList.Add(new ListObject(9, "Anniversary", Color.SandyBrown));  
        //this.LabelList.Add(new ListObject(10, "Phone Call", Color.RosyBrown));  
Sample link:  
Please let us know if you have any other queries,  
We do not have the direct support to change the backcolor for appointments like “item.LabelValue = Color.Red”.  
Mohanraj G 

DA darik September 11, 2017 02:08 PM UTC

Thanks for the reply worked perfectly! But I really need to list more than 10 colors in the list, is it possible?

MG Mohanraj Gunasekaran Syncfusion Team September 12, 2017 06:45 AM UTC

Hi Ary,  
Thanks for your update. 
Yes, it is possible. In order to add more number of colors for appointments, you can use our second suggestion as we provided the code example in our previous update and attached sample. Please refer to the below code example, 
Code example 
this.LabelList = new ListObjectList(); 
this.LabelList.Add(new ListObject(0, "None", Color.White)); 
this.LabelList.Add(new ListObject(1, "Important", Color.Red)); 
this.LabelList.Add(new ListObject(2, "Business", Color.Purple)); 
this.LabelList.Add(new ListObject(3, "Personal", Color.Yellow)); 
this.LabelList.Add(new ListObject(4, "Vacation", Color.Pink)); 
this.LabelList.Add(new ListObject(5, "Must Attend", Color.YellowGreen)); 
this.LabelList.Add(new ListObject(6, "Travel Required", Color.Violet)); 
this.LabelList.Add(new ListObject(7, "Needs Preparation", Color.Tomato)); 
this.LabelList.Add(new ListObject(8, "Birthday", Color.SpringGreen)); 
this.LabelList.Add(new ListObject(9, "Anniversary", Color.SandyBrown)); 
this.LabelList.Add(new ListObject(10, "Wedding function", Color.RosyBrown)); 
this.LabelList.Add(new ListObject(11, "Birthday Party", Color.DarkSalmon)); 
this.LabelList.Add(new ListObject(12, "Meeting", Color.DarkOliveGreen)); 
this.LabelList.Add(new ListObject(13, "Playing", Color.DarkSlateBlue)); 
Please let us know if you have any concerns. 

Mohanraj G  

Live Chat Icon For mobile
Up arrow icon