Skip to main content
A newer version of this page is available. .
All docs
V21.2

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.v21.2.dll

NuGet Packages: DevExpress.Win.Design, DevExpress.Win.Gantt

Declaration

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

Event Data

The QueryItemTemplate event's data class is DevExpress.XtraGantt.QueryItemTemplateEventArgs.

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