ItemsSource Container Generator Extensibility#1037
Merged
wieslawsoltes merged 4 commits intomasterfrom Feb 10, 2026
Merged
Conversation
This was referenced Feb 11, 2026
Closed
This was referenced Feb 18, 2026
Closed
This was referenced Feb 25, 2026
Closed
This was referenced Mar 2, 2026
This was referenced Mar 9, 2026
Closed
This was referenced Mar 18, 2026
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.
PR Summary: ItemsSource Container Generator Extensibility
Branch
feature/itemsource-container-generator-completeCommit Breakdown
857b3c6ca- Add extensible ItemsSource container generator pipelinebe760b2ca- Add unit, headless, and leak tests for container generatorse906474d0- Update ReactiveUI ItemsSource sample for custom generators9ca84b3e1- Document ItemsSource generator APIs and behaviorProblem
DocumentDock.ItemsSourceandToolDock.ItemsSourcehad template-driven generation but no unified, explicit container generation contract similar to item-container override hooks. Custom container type creation, per-item preparation, and cleanup were not first-class extension points.Solution
Introduced a dedicated container generator contract and integrated it into both source-backed pipelines:
IDockItemContainerGeneratorItemContainerGeneratoron both document and tool ItemsSource docksDockItemContainerGeneratorDocumentDockandToolDockfor add/remove/replace/reset and generator swapsAPI Additions and Changes
New Interface
src/Dock.Model/Core/IDockItemContainerGenerator.csCreateDocumentContainerPrepareDocumentContainerClearDocumentContainerCreateToolContainerPrepareToolContainerClearToolContainerUpdated Contracts
src/Dock.Model/Core/IItemsSourceDock.csIDockItemContainerGenerator? ItemContainerGenerator { get; }src/Dock.Model/Core/IToolItemsSourceDock.csIDockItemContainerGenerator? ItemContainerGenerator { get; }New Default Generator
src/Dock.Model.Avalonia/Controls/DockItemContainerGenerator.csDocumentTemplate/ToolTemplatecontent when availableRuntime Behavior
DocumentDock and ToolDock Integration
ItemContainerGeneratorwhen assignedDockItemContainerGenerator.DefaultCreate*ContainerthenPrepare*ContainerClear*ContainerItemsSourcechangeItemContainerGeneratorchangeToolTemplatechangeSafety/Interop Guards
IDocumentIToolTest Coverage
New Unit/Headless Tests
tests/Dock.Model.Avalonia.UnitTests/Controls/DockItemContainerGeneratorTests.cstests/Dock.Model.Avalonia.UnitTests/Controls/DocumentDockItemsSourceUITests.csNew Leak Tests
tests/Dock.Avalonia.LeakTests/DockItemContainerGeneratorLeakTests.csDocumentDockToolDockSample Updates
Updated the ReactiveUI ItemsSource sample to demonstrate real custom generator usage:
samples/DockReactiveUIItemsSourceSample/Infrastructure/SampleDockItemContainerGenerator.csDocument/Toolderived container typessamples/DockReactiveUIItemsSourceSample/Views/MainWindow.axamlSampleDockItemContainerGeneratordirectly into both docksx:DataTypeSourceIndexto confirm custom generator path at runtimesamples/DockReactiveUIItemsSourceSample/ViewModels/MainWindowViewModel.csDocumentation Updates
docfx/articles/dock-itemssource.mddocfx/articles/dock-model-controls.mdIItemsSourceDock/IToolItemsSourceDock+ generator contract detailsdocfx/articles/dock-reference.mdItemContainerGeneratorandDockItemContainerGeneratorValidation
Executed and passed:
dotnet test tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj -v minimaldotnet test tests/Dock.Avalonia.LeakTests/Dock.Avalonia.LeakTests.csproj -c Release -v minimaldotnet build samples/DockReactiveUIItemsSourceSample/DockReactiveUIItemsSourceSample.csproj -v minimalNet Diff (branch vs
origin/master)