$npx -y skills add DevExpress/agent-skills --skill devexpress-winforms-tree-listExpert skill for the DevExpress WinForms TreeList control (DevExpress.XtraTreeList.TreeList, DevExpress.Win.TreeList NuGet) — a data-aware control that shows data as a tree, a multi-column tree-grid, or both. Use when binding self-referential data (KeyFieldName, ParentFieldName,
| 1 | # DevExpress WinForms TreeList |
| 2 | |
| 3 | `TreeList` is a data-aware control that displays data as a tree, a multi-column tree-grid, or a combination of both. It supports **bound mode** (any traditional data source plus `KeyFieldName`/`ParentFieldName`), **unbound mode** (nodes created in code via `AppendNode`), and **virtual mode** (load children on demand). Because it includes grid functionality, you also get sorting, filtering, searching, summaries, in-place editing, validation, conditional formatting, and export — applied to a hierarchy. |
| 4 | |
| 5 | The control lives in the `DevExpress.XtraTreeList` namespace; nodes are `TreeListNode` objects (`DevExpress.XtraTreeList.Nodes`), columns are `TreeListColumn` objects (`DevExpress.XtraTreeList.Columns`). It ships with the `DevExpress.Win.TreeList` NuGet package. |
| 6 | |
| 7 | > **TreeList vs. Data Grid**: Use `TreeList` for hierarchical / parent-child data (org charts, file trees, BOM, categories). For purely flat tabular data, use the [Data Grid (`GridControl`)](https://docs.devexpress.com/content/WindowsForms/3455?md=true) — `TreeList` can show a flat list (with empty `KeyFieldName`/`ParentFieldName`) but the grid is the recommended control for that. |
| 8 | |
| 9 | ## When to Use This Skill |
| 10 | |
| 11 | - Displaying org charts, file/folder trees, project hierarchies, BOM, or any parent-child data |
| 12 | - Binding flat self-referential data (records with `ID` + `ParentID`) into a tree |
| 13 | - Building a tree programmatically with no data source (unbound mode, `AppendNode`) |
| 14 | - Loading child nodes on demand (dynamic / virtual mode) |
| 15 | - Defining columns, in-place editors, and edit forms for a tree-grid |
| 16 | - Sorting, filtering, searching, summarizing a tree |
| 17 | - Applying conditional formatting, node checkboxes/images, drag-and-drop |
| 18 | - Printing or exporting a tree to XLSX / PDF / XML |
| 19 | |
| 20 | ## Prerequisites & Installation |
| 21 | |
| 22 | ### NuGet Package |
| 23 | |
| 24 | ``` |
| 25 | DevExpress.Win.TreeList |
| 26 | ``` |
| 27 | |
| 28 | ```powershell |
| 29 | Install-Package DevExpress.Win.TreeList |
| 30 | ``` |
| 31 | |
| 32 | This package ships `DevExpress.XtraTreeList.v26.1.dll`. For print preview and export to XLSX/PDF/HTML, also add `DevExpress.Win.Printing`. All DevExpress packages in a project must share the same version. |
| 33 | |
| 34 | ### Required Namespace Imports |
| 35 | |
| 36 | ```csharp |
| 37 | using DevExpress.XtraTreeList; // TreeList, options, events |
| 38 | using DevExpress.XtraTreeList.Columns; // TreeListColumn |
| 39 | using DevExpress.XtraTreeList.Nodes; // TreeListNode |
| 40 | using DevExpress.XtraTreeList.StyleFormatConditions; // TreeListFormatRule (conditional formatting) |
| 41 | using DevExpress.XtraEditors; // XtraForm |
| 42 | using DevExpress.XtraEditors.Repository; // RepositoryItem* in-place editors |
| 43 | ``` |
| 44 | |
| 45 | ### Host Form |
| 46 | |
| 47 | Host `TreeList` on `XtraForm` (or `RibbonForm` / `FluentDesignForm`) and enable skins at startup (`WindowsFormsSettings.LoadApplicationSettings()` in `Program.Main`) for correct theming. |
| 48 | |
| 49 | ## Before You Start — Ask the Developer |
| 50 | |
| 51 | If the host agent has a structured question-asking tool available, use it to ask these questions one at a time with clear options — for example, Claude Code's `AskUserQuestion` tool or GitHub Copilot's `askQuestions` tool. If no such tool is available, ask the questions directly in the chat response before generating code. |
| 52 | |
| 53 | 1. **Data shape?** |
| 54 | - **Self-referential / flat** — each record has `ID` and `ParentID` → bound mode (`KeyFieldName`/`ParentFieldName`/`RootValue`). |
| 55 | - **No data source** — you build the tree in code → unbound mode (`AppendNode`). |
| 56 | - |