search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Different duration bar color for different resources

Asked by Agustin
12 years ago.

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

Comment posted by Lauwens
12 years ago.
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
12 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 Agustin
12 years ago.
Thanks
Comment posted by Dan Letecky
12 years ago.
Lauwens, Thanks for posting the answer!
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.