windowsforms-devexpress-dot-xtragantt-dot-ganttcontrol.md
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.v25.2.dll
NuGet Package : DevExpress.Win.Gantt
[DXCategory("Events")]
public event QueryItemTemplateEventHandler QueryItemTemplate
<DXCategory("Events")>
Public Event QueryItemTemplate As QueryItemTemplateEventHandler
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. |
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.
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;
}
}
Private Sub GanttControl1_QueryItemTemplate(ByVal sender As Object, ByVal e As QueryItemTemplateEventArgs)
Select Case e.ItemType
Case GanttChartItemType.Task, GanttChartItemType.SummaryTask
e.Template.Assign(TaskTemplate)
Case GanttChartItemType.Progress, GanttChartItemType.SummaryTaskProgress
e.Template.Assign(TaskProgressTemplate)
Case GanttChartItemType.TextLabel
e.Template.Assign(TaskTextLabelTemplate)
End Select
End Sub
See this documentation article for more information: HTML Templates in Gantt Control.
See Also