GanttView for WPF | ComponentOne
In This Topic
    Set Back Color of Day
    In This Topic

    GanttView enables users to highlight a specific day of week by setting its back color. For instance, the weekends in a gantt view can be highlighted in a different color to distinguish them from workweek. This can be achieved in code by subscribing the PaintDay event and setting the BackColor property to color specific days.

    The following image shows a GanttView with weekends highlighted by a different color.

    The following code illustrates how to set back color of weekend. This example uses the sample created in the Quick start.

    Private Sub gv_PaintDay(sender As Object, e As PaintDayEventArgs)
        If e.[Date].DayOfWeek = DayofWeek.Saturday OrElse e.[Date].DayOfWeek = DayofWeek.Sunday Then
            e.BackColor = Colors.MistyRose
        End If
    End Sub
    
    //Set back color for a specific day of week
    private void gv_PaintDay(object sender, PaintDayEventArgs e)
    {
        if (e.Date.DayOfWeek == DayOfWeek.Saturday || e.Date.DayOfWeek == DayOfWeek.Sunday)
        {
            e.BackColor = Colors.MistyRose;
        }
    }