Home Unanswered Active Tags New Question

Different duration bar color for different resources

Hello,

I need to show all the information or all the events related with different resources at the same time using the daypilot calendar control, so, in order to identify which events belong to an specific resource i need to assign a color per resource, which arises the next questions:

1. Is it possible to do this ?
2. How can I change the color of the event per resource?

Thanks in advanced

Asked by Agustin 4 years ago.
Replies
Place the resource in the DataTagFields and in the BeforeEventRender you can switch the e.Tag[0] en set the e.BackgroundColor to a desired color foreach resource
Comment posted by Lauwens 4 years ago.
Perhaps I wasn't that clear, and i see you wanted to change the DurationBar not the whole background color So here code example
protected void DayPilotCalendar1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
    {
        
        switch (e.Tag)
        {
            case 0:
                e.DurationBarColor = "yellow";
                break;
            case 1:
                e.DurationBarColor = "red";
                break;
            case 2:
                e.DurationBarColor = "green";
                break;
        }
    }
Comment posted by Lauwens 4 years ago.
Thanks
Comment posted by Agustin 4 years ago.
Lauwens, Thanks for posting the answer!
Comment posted by Dan Letecky 4 years ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java