Skip to content

Support external document tab strips in Dock drag/drop workflows#1062

Merged
wieslawsoltes merged 9 commits intowieslawsoltes:masterfrom
danwalmsley:feature/external-tabstrip-support
Feb 26, 2026
Merged

Support external document tab strips in Dock drag/drop workflows#1062
wieslawsoltes merged 9 commits intowieslawsoltes:masterfrom
danwalmsley:feature/external-tabstrip-support

Conversation

@danwalmsley
Copy link
Contributor

@danwalmsley danwalmsley commented Feb 24, 2026

PR Summary

This PR adds Dock support for hosting a DocumentTabStrip outside the DocumentControl/DockControl visual tree while preserving document tab drag/drop behavior, finalized with an explicit contract-based API.

What this fixes

  • Document tabs can be dragged out from an external tab strip.
  • Dock/host-window drag hover detects external tab strip drop areas.
  • Dock adorner can appear over external tab strip targets.
  • Drops work across the full tab strip surface (not only existing tab items).
  • Tab drag preview can match the dragged tab size for a more consistent drag illusion.

Key changes

  • Introduced an explicit external-surface contract:
    • IExternalDockSurface (DockControl owner + SurfaceControl).
  • Added registration API on DockControl:
    • RegisterExternalDockSurface(...)
    • UnregisterExternalDockSurface(...)
    • internal weak-reference tracking, owner handoff between dock controls, and attach/detach lifecycle handling.
  • Removed the legacy attached-property path:
    • deleted DockProperties.ExternalDockControl and related accessors/usage.
  • Updated DocumentTabStrip to implement IExternalDockSurface.
  • Updated DocumentTabStripItem drag start resolution:
    • now resolves owning dock control via DockHelpers.ResolveDockControl(...) (ancestor first, then registered external owner).
  • Extended external hit-testing/drop discovery:
    • searches registered external surfaces for a dock control,
    • prefers dock-target hits for adorner activation,
    • falls back to external tab strip root so empty/trailing strip regions are droppable.
  • Kept preferred drag-preview sizing for document tab drags (preview can match dragged tab dimensions).
  • Added headless coverage for registration/ownership/hit-testing lifecycle:
    • tests/Dock.Avalonia.HeadlessTests/ExternalDockSurfaceTests.cs.
  • Added sample app:
    • samples/DockExternalTabStripsSample
    • demonstrates two DockControls, each rooted by a DocumentDock, each with one registered external DocumentTabStrip, using stock Fluent tab visuals.

Commit breakdown

  • Support external tab strip drop target discovery
  • Allow external document tab strips to start dock drags
  • Match tab drag preview size to dragged tab
  • Introduce external dock surface contract and registration API
  • Add headless tests for external dock surface registration
  • Add external tab strips sample with two dock controls
  • Follow-up polish/fixes:
    • use layout rounding for the tabstrip separators.
    • fix tests

Notes

  • Existing in-tree DocumentTabStrip behavior remains unchanged.
  • External usage now goes through explicit contract + registration API (legacy attached-property path removed).

@wieslawsoltes wieslawsoltes merged commit 2476095 into wieslawsoltes:master Feb 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants