All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GanttControl.CustomTaskDisplayText Event

Allows you to specify the text displayed inside, to the left, and to the right of the task.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v20.1.dll

Declaration

[DXCategory("Events")]
public event CustomTaskDisplayTextEventHandler CustomTaskDisplayText
<DXCategory("Events")>
Public Event CustomTaskDisplayText As CustomTaskDisplayTextEventHandler

Event Data

The CustomTaskDisplayText event's data class is CustomTaskDisplayTextEventArgs. The following properties provide information specific to this event:

Property Description
InsideText Gets or sets the text displayed inside the task's bar.
LeftText Gets or sets the text displayed to the left of the task's bar.
Node Gets the processed node.
RightText Gets or sets the text displayed to the right of the task's bar.
TaskInfo Provides access to view information about the task.

Examples

The code below shows how to display captions to the left and to the right of the bars.

HashSet<int> criticalPathIds = new HashSet<int> { 1, 2, 3, 6, 7, 8, 10, 11, 13 };
ganttControl.CustomTaskDisplayText += (sender, e) => {
    int taskId = Convert.ToInt32(e.Node.GetValue("Id"));
    if(criticalPathIds.Contains(taskId)) {
        e.RightText = "High priority";
    }
    else {
        e.RightText = string.Empty;
        e.LeftText = "Normal priority";
    }
};
NOTE

Run the Gantt Code Examples demo to see the complete example.

See Also