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

Background color set in BeforeEventRender handler is only showing when the full event is visible

Asked by Anonymous
5 years ago.

When I set the background color of an event in the BeforeEventRender handler (in code), the background is correctly set, but it is only visible when the event is fully visible in the scheduler. I need the event to have this specific background regardless of how much of the event is visible.
The background is correctly set if the event is fully visible, as well if the end is invisible at the right of the scheduler, but NOT if the start is invisible at the left of the scheduler. Probably has to do with the text in the event being shifted when the start of the event is invisible.

See attached picture with different views, used code below:

protected void DayPilotCalendar1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
{
var source = (LeanVehicleDriverHistoryDto)e.DataItem.Source;
if (!string.IsNullOrEmpty(source.VehicleStateColorCode))
{
e.DurationBarColor = source.VehicleStateColorCode;
}
if (source.InvoicingStatus == CommonObjects.Enums.VehicleDriverHistoryInvoicingStatusEnum.Invoice)
{
e.BackgroundColor = "DarkGray";
}
else if (source.InvoicingStatus == CommonObjects.Enums.VehicleDriverHistoryInvoicingStatusEnum.InvoiceProposal)
{
e.BackgroundColor = "LightGray";
}
}

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