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

Scheduler - Grey out events on saturday and sunday

Asked by Ryan
8 years ago.

Hi,

for the webforms version:

I have events that may overlap on the weekend, where the weekend cell is dark grey because the office is closed. I need to differentiate the event color for Saturdays and Sundays. E.g. on Weekdays, the event would be white and on weekends, grey.

Is this possible? and how would I go about it. I've been trying to fiddle with _BeforeEventRender, but I'm not making any headway.

Thanks

Ryan

Answer posted by Dan Letecky [DayPilot]
8 years ago.

The following code will change the event color to gray if it it overlaps a weekend:

    protected void DayPilotScheduler1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
    {
        for (DateTime day = e.Start.Date; day < e.End; day = day.AddDays(1))
        {
            if (day.DayOfWeek == DayOfWeek.Saturday || day.DayOfWeek == DayOfWeek.Sunday)
            {
                e.BackgroundColor = "gray";
                return;
            }
        }
    }

It is also possible to set just the overlapping part to gray using active areas (http://doc.daypilot.org/scheduler/event-active-areas/).

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.