Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

#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