Skip to main content
All docs
V24.1

GanttControl.QueryItemTemplate Event

Allows you to assign HTML-CSS templates from the GanttControl.HtmlTemplates collection to UI elements of the required type.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.1.dll

NuGet Package: DevExpress.Win.Gantt

Declaration

[DXCategory("Events")]
public event QueryItemTemplateEventHandler QueryItemTemplate

Event Data

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

Property Description
Item Gets the information about the processed UI element (regular task, summary task, baseline, etc.).
ItemType Gets a value that identifies the element type (regular task, summary task, baseline, etc.).
Template Gets the HTML-CSS template.

Remarks

The code below assigns the “TaskTemplate” template to regular and summary tasks, “TaskProgressTemplate” to progress lines of regular and summary tasks, and “TaskTextLabelTemplate” to text labels.

HTML templates in Gantt Control

void GanttControl1_QueryItemTemplate(object sender, QueryItemTemplateEventArgs e) {
    switch(e.ItemType) {
        case GanttChartItemType.Task:
        case GanttChartItemType.SummaryTask:
            e.Template.Assign(TaskTemplate);
            break;
        case GanttChartItemType.Progress:
        case GanttChartItemType.SummaryTaskProgress:
            e.Template.Assign(TaskProgressTemplate);
            break;
        case GanttChartItemType.TextLabel:
            e.Template.Assign(TaskTextLabelTemplate);
            break;
    }
}

See this documentation article for more information: HTML Templates in Gantt Control.

See Also