Skip to main content

Lists, Trees, Repeaters, and Hierarchical Data

This example is the Lists and Trees section is the document explorer — a TreeView that loads only the top level and fetches each branch in AfterExpand, a ListView in virtual mode whose VirtualListSize comes from a server-side DocumentPage, one ImageList shared by both, and a DocumentDetailControl UserControl that receives a finished DocumentModel.

The shell and the earlier sections come from Modules 1–3. This module adds Services/DocumentService.cs, four models, ListsTrees/, wwwroot/icons/ and docs/ExplorerNotes.md.

Run it

cd "LearnWisej-Samples/Mastering the Control Library Course/Module 4/OperationsConsole"
dotnet run -f net10.0 --urls http://localhost:5704

Then open http://localhost:5704 and select Lists and Trees. Run from the project folder: the static file server serves it, which is how wwwroot/icons/*.svg reaches the browser.

The data

DocumentService generates 557 documents in 6 top-level and 12 sub-categories, in memory, with a fixed seed. Three folders are called "Contracts" (categories 7, 10, 13); Contoso ▸ Contracts holds 312 documents; two categories are empty and Archive 2019-2023 has no children; every 37th document is flagged. Every call takes ~300 ms so the loading state is visible.

What to try

ActionWhat you should see
Open Lists and Treessix collapsed folder nodes
Expand Contosoonly Contoso's children load
Expand Archive 2019-2023no children arrive; amber status "Archive 2019-2023" has no sub-categories.
Select Contoso ▸ Contractsthe list shows the loader, then 312 rows; the footer reads 8 of 312 items created (however many rows fit)
Select Fabrikam ▸ Contractssame folder text, 36 different documents
Pick a documentthe detail card fills; the StatusBar shows Record: DOC-000312; a flagged document shows a red status and the warning icon
Select Shared templates ▸ Contract templatesthe amber No documents in this category band
Tick Simulate service failure, then expand or selectred status, an AlertBox, a friendly message; the list is never half-built. Untick and try again to recover
Refresh on the ToolBarthe tree reloads the top level

Where things live

OperationsConsole/
├─ Sections/ListsTreesPage.cs / .Designer.cs lazy tree, virtual list, selection → service → detail
├─ ListsTrees/DocumentDetailControl.cs Show(DocumentModel) + ShowMessage(string)
├─ Models/CategoryNode, DocumentSummary, DocumentPage, DocumentModel
├─ Services/DocumentService.cs GetTopCategories / GetChildren / GetDocumentPage / GetDocument
├─ wwwroot/icons/ folder, contract, invoice, drawing, warning (16×16 SVG)
└─ docs/ExplorerNotes.md data shape → control, identity rule, lazy + virtual, what breaks at 10×

Known simplifications

  • DocumentPage holds the whole category (Items.Count == Total); ExplorerNotes.md §5 names this as the first fix at 10×.
  • ListView.FullRowSelect does not exist in Wisej.NET 4.1; MultiSelect = false + SelectionMode.One is the equivalent.
  • PrefetchItems = 0 on purpose, so the created-items counter shows exactly what the visible rows cost.