Merged
Conversation
Avoid clearing bound presenter content and fallback to new controls when detach fails.
Cover detached presenters and cached control reuse paths.
Skip recycling when a ContentPresenter template already recycles. This prevents reparenting errors without reflection.
Cover fallback behavior when cached controls remain attached.
Allow reparenting cached controls from ContentPresenter regardless of recycling templates.
Exercise reparenting through recycling templates and ContentPresenter detachment paths.
Avoid reusing attached views when ids collide.
Cover id collisions while a cached control is still visible.
Remove instance tracking and the test that depended on it.
Activate matching documents by Id and cover with unit tests.
Handle visual parents when rebuilding overlay pipeline.
Always add new documents unless the instance is already docked.
Avoid reusing an existing control when building a new key and add coverage for cross-key recycling.
Ensure recycled ViewModelViewHost refreshes ViewModel.
Use a per-factory cache so floating hosts reuse controls.
Only short-circuit OpenDocument when the owner still contains the doc.
Align TryToUseIdAsKey when sharing recyclers.
Handle ContentPresenter child detachment before rebuilding pipeline.
This was referenced Feb 2, 2026
This was referenced Feb 16, 2026
Closed
This was referenced Feb 23, 2026
Closed
This was referenced Mar 2, 2026
Closed
This was referenced Mar 11, 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.
Overview
This change set fixes control recycling across floating host windows and strengthens view reuse/detachment behavior throughout Dock's Avalonia integration. It also tightens document navigation behavior so previously closed documents reopen correctly, plus adds targeted tests.
Key Changes
ControlRecyclinginstance per factory acrossDockControlinstances so floating windows reuse the same cached views; keepTryToUseIdAsKeyaligned when a local setting differs.IRecyclingDataTemplate, detach controls from their visual/logical parents safely (includingContentPresenter.Child), and rebuild fallback controls when detachment fails.ControlRecyclingDataTemplateandTemplateHelperto honorexistingcontrols and detach/rebuild safely to avoid orphaned visual parents.ManagedDockWindowDocumentreuse theexistingcontrol parameter and detach direct/template content with a safe fallback, preventing recycled controls from staying attached elsewhere.OverlayHostpipeline rebuilding to detach templated content by checking bothContentPresenter.ChildandContentPresenter.Content.DockNavigationService.OpenDocumentto only short-circuit when the document is still in its owner dock; otherwise re-add the document.ViewModelinstance in the ReactiveUI canonical sample to prevent redundant updates.Tests Added/Updated
ContentPresenterand preserving bindings during recycling reparenting.Tests Run
dotnet test tests/Dock.Model.ReactiveUI.UnitTests/Dock.Model.ReactiveUI.UnitTests.csprojdotnet build src/Dock.Avalonia/Dock.Avalonia.csproj -c Debugdotnet test(timed out after 2m and 4m)