Skip to main content
All docs
V24.2

TreeList.QueryNodeTemplate Event

Allows you to assign HTML-CSS templates from the HtmlTemplates collection to nodes.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.2.dll

Declaration

[DXCategory("Events")]
public event QueryNodeHtmlTemplateEventHandler QueryNodeTemplate

Event Data

The QueryNodeTemplate event's data class is DevExpress.XtraTreeList.QueryNodeTemplateEventArgs.

Remarks

Handle the QueryNodeTemplate event 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);
    }
}

Run Demo: HTML/CSS Templates in TreeList

The NodeHtmlTemplate property specifies the default HTML-CSS template for nodes.

See Also