windowsforms-devexpress-dot-xtragantt-dot-timeline.md
A timeline bar.
Namespace : DevExpress.XtraGantt.TimeLine
Assembly : DevExpress.XtraGantt.v25.2.dll
NuGet Package : DevExpress.Win.Gantt
public class TimelineBar
Public Class TimelineBar
The following members return TimelineBar objects:
Use the GanttControl.TimelineBars property to access a collection of timeline bars displayed on the timeline.
Use the GanttControl.AddTimelineBar and GanttControl.RemoveTimelineBar methods to add/remove timeline bars to/from the collection.
The following example demonstrates how to create a timeline bar and display it on the timeline.
using DevExpress.XtraGantt;
using DevExpress.XtraGantt.TimeLine;
// Creates a timeline bar and displays it on the timeline.
TimelineBar timelineBar = ganttControl1.AddTimelineBar();
// Displays the focused task on the timeline bar.
timelineBar.AddTask(ganttControl1.FocusedNode as GanttControlNode);
Imports DevExpress.XtraGantt
Imports DevExpress.XtraGantt.TimeLine
' Creates a timeline bar and displays it on the timeline.
Private timelineBar As TimelineBar = ganttControl1.AddTimelineBar()
' Displays the focused task on the timeline bar.
timelineBar.AddTask(TryCast(ganttControl1.FocusedNode, GanttControlNode))
Use the timeline bar’s Nodes property to access its tasks. The following methods allow you to manage the [TimelineBar.Nodes] collection:
The date range of timeline bars matches the duration of the project. Use the TimelineBar.Options.StartDate and TimelineBar.Options.FinishDate properties to specify a custom date range.
You can also use the Gantt control’s SetTimelineBarRange method to specify a custom date range for a specific timeline bar.
Users can use a context menu to specify a custom date range for the focused timeline bar.
Read the following topic for detailed information and examples: Timeline.
Object TimelineBar
See Also