Skip to content

Full Docking Window Property Tracking (Including Window State)#1028

Merged
wieslawsoltes merged 4 commits intomasterfrom
feature/issue-1024-window-state-tracking
Feb 7, 2026
Merged

Full Docking Window Property Tracking (Including Window State)#1028
wieslawsoltes merged 4 commits intomasterfrom
feature/issue-1024-window-state-tracking

Conversation

@wieslawsoltes
Copy link
Copy Markdown
Owner

PR Summary: Issue #1024 - Full Docking Window Property Tracking (Including Window State)

Branch

  • feature/issue-1024-window-state-tracking

Issue

Problem

Floating dock windows persisted size and position, but did not fully persist/restore runtime window state (especially maximized/fullscreen scenarios). In managed mode, fullscreen intent could degrade to normal during MDI state synchronization.

What This PR Changes

1) Introduces explicit window state in dock model

  • Added DockWindowState enum in core model:
    • Normal
    • Minimized
    • Maximized
    • FullScreen
  • Added WindowState property to IDockWindow.

2) Extends host abstraction for state roundtrip

  • Added new members to IHostWindow:
    • SetWindowState(DockWindowState)
    • GetWindowState()
  • Updated HostAdapter so Save() captures host state and Present() reapplies model state.

3) Wires state into all dock window implementations

Updated all model variants to include serializable WindowState backing/state propagation:

  • Dock.Model.Avalonia.Core.DockWindow
  • Dock.Model.Mvvm.Core.DockWindow
  • Dock.Model.Inpc.Core.DockWindow
  • Dock.Model.Prism.Core.DockWindow
  • Dock.Model.CaliburMicro.Core.DockWindow
  • Dock.Model.ReactiveProperty.Core.DockWindow
  • Dock.Model.ReactiveUI.Core.DockWindow

4) Avalonia host behavior and state fidelity

  • Added DockWindowStateHelper for mapping:
    • Avalonia WindowState <-> DockWindowState
    • MdiWindowState <-> DockWindowState
  • HostWindow now:
    • Reads/writes window state through IHostWindow API.
    • Tracks and returns last known normal bounds while non-normal, improving persisted position/size stability.
    • Saves when host WindowState changes while tracked.
  • ManagedHostWindow now:
    • Persists model WindowState before MDI sync.
    • Preserves fullscreen intent when MDI mapping yields Normal.
  • ManagedDockWindowDocument now:
    • Initializes from model state.
    • Syncs state both directions with guard logic to avoid fullscreen downgrade.

5) Serialization updates

  • Updated Avalonia JSON serializer allowlist to include WindowState for IDockWindow/DockWindow.
  • Roundtrip tests now include floating window state assertions.

6) Documentation updates

Updated docs to reflect new API and behavior:

  • docfx/articles/dock-windows.md
  • docfx/articles/dock-adapters.md
  • docfx/articles/dock-serialization.md
  • docfx/articles/dock-enums.md

Commits (Granular)

  1. d024471e7 - Add dock window state model and serialization plumbing
  2. 496baacae - Track and preserve host window state in Avalonia hosts
  3. 49b1e9a69 - Add window state regression and roundtrip tests
  4. 7805556c8 - Document dock window state persistence and APIs

Tests Added/Updated

Model and adapter tests

  • ReactiveUI window tests now validate save/present/exit state roundtrip.
  • Prism and Caliburn window tests now validate state propagation.

Avalonia tests

  • HostWindowMethodsTests: explicit host window state API coverage.
  • DockControlMainWindowTests: custom host state method coverage.
  • ManagedWindowParityTests:
    • managed state roundtrip checks
    • regression test for fullscreen not degrading to normal during managed sync.

Serializer tests

  • DockLayoutRoundtripTests: verifies floating IDockWindow.WindowState survives serializer roundtrip.
  • AvaloniaDockSerializerTests: ensures WindowState is emitted.

Validation Run

Executed and passing:

  • dotnet test tests/Dock.Model.ReactiveUI.UnitTests/Dock.Model.ReactiveUI.UnitTests.csproj --nologo
  • dotnet test tests/Dock.Model.Prism.UnitTests/Dock.Model.Prism.UnitTests.csproj --nologo
  • dotnet test tests/Dock.Model.CaliburMicro.UnitTests/Dock.Model.CaliburMicro.UnitTests.csproj --nologo
  • dotnet test tests/Dock.Serializer.UnitTests/Dock.Serializer.UnitTests.csproj --nologo
  • dotnet test tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj --nologo
  • dotnet test tests/Dock.Avalonia.HeadlessTests/Dock.Avalonia.HeadlessTests.csproj --nologo
  • dotnet build Dock.slnx --nologo

Notable Compatibility Note

  • IDockWindow and IHostWindow interface surfaces were extended (intentional API expansion). External custom implementations must implement the new members.

PR Link

Fixes #1024

@wieslawsoltes wieslawsoltes merged commit da4f21f into master Feb 7, 2026
20 of 23 checks passed
@wieslawsoltes wieslawsoltes deleted the feature/issue-1024-window-state-tracking branch February 7, 2026 21:03
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.

Floating window restore after layout serialization: inaccurate position and missing maximized state

1 participant