Skip to content

Comments

Add CacheDocumentTabContent option to Browser/Fluent/Simple themes and document usage#1058

Merged
wieslawsoltes merged 1 commit intowieslawsoltes:masterfrom
danwalmsley:feature/keep-tab-content-alive
Feb 19, 2026
Merged

Add CacheDocumentTabContent option to Browser/Fluent/Simple themes and document usage#1058
wieslawsoltes merged 1 commit intowieslawsoltes:masterfrom
danwalmsley:feature/keep-tab-content-alive

Conversation

@danwalmsley
Copy link
Contributor

@danwalmsley danwalmsley commented Feb 19, 2026

Summary

This PR adds an opt-in CacheDocumentTabContent theme option to Dock themes so document tab content can stay alive across tab switches (instead of being recreated each time).

Supported themes:

  • BrowserTabTheme
  • DockFluentTheme
  • DockSimpleTheme

What changed

  • Added CacheDocumentTabContent direct property to:
    • /Volumes/SSD/repos/StackWich/Dock/src/Dock.Avalonia.Themes.Browser/Styles/BrowserTabTheme.axaml.cs
    • /Volumes/SSD/repos/StackWich/Dock/src/Dock.Avalonia.Themes.Fluent/DockFluentTheme.axaml.cs
    • /Volumes/SSD/repos/StackWich/Dock/src/Dock.Avalonia.Themes.Simple/DockSimpleTheme.axaml.cs
  • Split Fluent DocumentControl templates into:
    • DockDocumentControlSingleContentTemplate (default behavior, recycling template path)
    • DockDocumentControlCachedContentTemplate (cached content host for tabs, no ControlRecyclingDataTemplate)
    • File: /Volumes/SSD/repos/StackWich/Dock/src/Dock.Avalonia.Themes.Fluent/Controls/DocumentControl.axaml
  • Added ReferenceEqualsMultiConverter for active-tab visibility checks in cached mode:
    • /Volumes/SSD/repos/StackWich/Dock/src/Dock.Avalonia/Converters/ReferenceEqualsMultiConverter.cs
  • Updated docs:
    • /Volumes/SSD/repos/StackWich/Dock/README.md
    • /Volumes/SSD/repos/StackWich/Dock/docfx/articles/dock-theme-browser.md
    • /Volumes/SSD/repos/StackWich/Dock/docfx/articles/dock-theme-fluent.md
    • /Volumes/SSD/repos/StackWich/Dock/docfx/articles/dock-theme-simple.md

Why

Tab switching performance regressed when content was recreated on each activation. This adds an explicit startup-time option to keep document views alive and restore fast tab switching behavior.

Usage

<browserTheme:BrowserTabTheme CacheDocumentTabContent="True" />
<dockFluent:DockFluentTheme CacheDocumentTabContent="True" />
<dockSimple:DockSimpleTheme CacheDocumentTabContent="True" />

Notes

  • CacheDocumentTabContent is intended as a configuration-time choice (not a runtime toggle).
  • Cached mode avoids ControlRecyclingDataTemplate for document tab content to prevent recycling-related behavior when content is intentionally kept alive.

Validation

  • Built successfully with:
    • dotnet build /Volumes/SSD/repos/StackWich/Startups/Sandwich.Desktop/Sandwich.Desktop.csproj

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