TreeView — Image Customization & Configuration

These properties control the expand/collapse icon images, tooltip text, and data-binding configuration of the TreeView component.


Custom Expand / Collapse Images with Tooltips

Use CollapseImageUrl, ExpandImageUrl, and NoExpandImageUrl to replace the default +/- icons. Tooltips are provided via CollapseImageToolTip and ExpandImageToolTip.

<TreeView CollapseImageUrl="/img/collapse.png"
          CollapseImageToolTip="Click to collapse"
          ExpandImageUrl="/img/expand.png"
          ExpandImageToolTip="Click to expand"
          NoExpandImageUrl="/img/leaf.png">
    <Nodes>
        <TreeNode Text="Documents" Value="docs" Expanded="true">
            <TreeNode Text="Reports" Value="reports">
                <TreeNode Text="Q1 Report" Value="q1" />
            </TreeNode>
        </TreeNode>
    </Nodes>
</TreeView>

MaxDataBindDepth

MaxDataBindDepth limits how many levels of a data source are bound to the tree. The default is -1 (bind all levels). Setting it to 2 restricts binding to 2 levels deep.

<TreeView MaxDataBindDepth="2">
    <!-- Only 2 levels will be bound from a data source -->
</TreeView>

EnableClientScript & AutoGenerateDataBindings

EnableClientScript (default true) is accepted for migration compatibility with Web Forms. AutoGenerateDataBindings controls whether data bindings are automatically created when a data source is attached.

<TreeView EnableClientScript="false" AutoGenerateDataBindings="false">
    <Nodes>
        <TreeNode Text="Manual Bindings" Value="manual" />
    </Nodes>
</TreeView>

Properties Reference

PropertyTypeDefaultDescription
CollapseImageUrlstringnullURL of the image shown on collapsible nodes
CollapseImageToolTipstringnullTooltip for the collapse image
ExpandImageUrlstringnullURL of the image shown on expandable nodes
ExpandImageToolTipstringnullTooltip for the expand image
NoExpandImageUrlstringnullURL of the image shown on leaf nodes (no children)
LineImagesFolderstringnullFolder path containing line images for the tree
MaxDataBindDepthint-1Maximum depth for data binding (-1 = all levels)
AutoGenerateDataBindingsboolfalseWhether to auto-generate data bindings from a data source
EnableClientScriptbooltrueMigration stub — accepted for compatibility with Web Forms