Document container virtualization for VirtualizingStackPanel - #1113
Closed
gentledepp wants to merge 1 commit into
Closed
Document container virtualization for VirtualizingStackPanel#1113gentledepp wants to merge 1 commit into
gentledepp wants to merge 1 commit into
Conversation
11 tasks
Adds a page covering the opt-in in both forms (EnableVirtualization in XAML, RecycleKeySelector on a FuncDataTemplate), how to pick a recycle key, warmup, the per-item memory the panel retains, and the process-wide kill switch. Calls out that opted-in containers stay in the visual tree and are only hidden, so Loaded/Unloaded and AttachedToVisualTree/DetachedFromVisual- Tree no longer fire per item. Documents the API proposed in AvaloniaUI/Avalonia#20993.
gentledepp
force-pushed
the
feature/20259_virtualizingdatatemplate_master
branch
from
August 17, 2026 05:54
cd57e24 to
ba15900
Compare
Contributor
|
Closing this as the corresponding PR in the main Avalonia repo has been closed without merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation for the container-level virtualization API proposed in AvaloniaUI/Avalonia#20993. Draft: do not merge before that PR lands, and the API names may still change in its review.
What this adds
docs/app-development/container-virtualization.md, a how-to page under App Development, plus a pointer to it from the UI virtualization section ofperformance.mdand a sidebar entry.The page covers:
Content/ContentTemplateand the template's control tree is rebuilt; with it, containers are pooled per recycle key and the tree stays in place.EnableVirtualization="True"on a XAMLDataTemplate, andRecycleKeySelectoron aFuncDataTemplate.DataTemplatescollection caveat: a template placed there does not opt in, because collection templates are not copied onto containers.IVirtualizingDataTemplatetemplate selector, including the rule thatBuild(data, existing)must returnexisting.EnableWarmupandMinPoolSizePerKey.ContainerVirtualization.IsEnabledkill switch.The caveat that most needs review
A
:::dangerblock, because it is the one way this feature can break a working list:So
Loaded,Unloaded,AttachedToVisualTreeandDetachedFromVisualTreefire once, for the first item those controls ever displayed. They do not fire again as the container is reused, and the unload side does not fire when an item scrolls away. Any control that initializes per item on load, or releases state on unload, misbehaves: media players, map and chart controls, anything that subscribes to a service inOnAttachedToVisualTree. The page gives the two ways out, which are to move the work toDataContextChanged, or to leave that template opted out.How the framework should treat view lifecycle events under container recycling is an open question on AvaloniaUI/Avalonia#20993. If that lands differently, this section is what changes.
Notes for the reviewer
.claude/skills/docs-style-linthouse rules:doc-typefrontmatter, sentence-case headings, no em or en dashes, language tags on every fence,## See alsohandoff. Self-checked, not run through the skill.EnableVirtualization,MaxPoolSizePerKey,MinPoolSizePerKey,RecycleKeySelector,IVirtualizingDataTemplate.GetKey,EnableWarmup,ContainerVirtualization.IsEnabled.ComplexScrollBenchmarkin the code PR: 5,000 heterogeneous rows, desktop x64, MediumRun. No mobile figures have been measured, so the page states the mobile case directionally and quotes no number for it.:::infoline naming the pull request should be replaced with the release version once the API ships.