TreeList.HtmlTemplates Property
A collection of HTML-CSS templates that can be applied to TreeList and Gantt UI elements.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v24.1.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList
Declaration
[XtraSerializableProperty(XtraSerializationVisibility.Collection)]
public HtmlTemplateCollection HtmlTemplates { get; }
Property Value
Type | Description |
---|---|
HtmlTemplateCollection | A collection of HTML-CSS templates. |
Remarks
HTML Templates in TreeList
The TreeList control supports HTML/CSS templates and allows you to generate unique custom layouts for nodes and its empty space area.
Handle the QueryNodeTemplate and QueryEmptyTreeTemplate events to apply a template from the HtmlTemplates
collection based on a condition.
using DevExpress.XtraTreeList;
using DevExpress.HTML.Demos.Modules.TreeList;
// ...
EditingComment editingComment;
private void treeList1_QueryNodeTemplate(object sender, QueryNodeTemplateEventArgs e) {
var comment = treeList1.GetRow(e.Node.Id);
if(editingComment != null && editingComment.Comment == comment) {
if(editingComment.Mode == CommentEditingMode.Editing)
e.Template.Assign(editCommentTemplate);
else
e.Template.Assign(replyCommentTemplate);
}
}
Use the NodeHtmlTemplate property to specify the default HTML-CSS template for nodes.
HTML Templates in Gantt Control
The Gantt control supports HTML/CSS templates for the following UI elements:
- Tasks, Summaries, and Milestones
- Regular and Summary Task Progress
- Regular, Summary, and Milestone Task Baselines
- Text Labels
- Interaction tooltips
- Split Tasks
Handle the GanttControl.QueryItemTemplate event to apply a template.
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 help topic for more information: HTML Templates in Gantt Control.