New to Telerik UI for WinFormsStart a free 30-day trial

Timeline Item Formatting

Updated over 6 months ago

The TimelineItemFormatting event allows you to format the style and look of the items in the timeline container. The following example demonstrates how to make the timeline appear as a checkered flag.

C#
private void radGanttView1_TimelineItemFormatting(object sender, GanttViewTimelineItemFormattingEventArgs e)
{
    CultureInfo currentCulture = CultureInfo.CurrentCulture;
    int weekNo = currentCulture.Calendar.GetWeekOfYear(e.Item.Start, currentCulture.DateTimeFormat.CalendarWeekRule, currentCulture.DateTimeFormat.FirstDayOfWeek);
    Color color1 = Color.Black;
    Color color2 = Color.White;
    if (weekNo % 2 == 0)
    {
        color1 = Color.White;
        color2 = Color.Black;
    }
    e.ItemElement.TopElement.DrawFill = true;
    e.ItemElement.TopElement.DrawBorder = false;
    e.ItemElement.TopElement.GradientStyle = GradientStyles.Solid;
    e.ItemElement.TopElement.BackColor = color1;
    e.ItemElement.TopElement.ForeColor = color2;
    foreach (LightVisualElement element in e.ItemElement.BottomElement.Children)
    {
        element.BackColor = color2;
        element.ForeColor = color1;
        element.DrawBorder = false;
    }
}

WinForms RadGanttView Timeline Item Formatting

See Also

In this article
See Also
Not finding the help you need?
Contact Support