Skip to content

Managed windows#1002

Merged
wieslawsoltes merged 19 commits intomasterfrom
feature/managed-windows
Jan 24, 2026
Merged

Managed windows#1002
wieslawsoltes merged 19 commits intomasterfrom
feature/managed-windows

Conversation

@wieslawsoltes
Copy link
Copy Markdown
Owner

@wieslawsoltes wieslawsoltes commented Jan 24, 2026

Managed Windowing System PR Summary

Overview

  • Managed floating windows render inside the main window using the MDI layer instead of native OS windows.
  • Drag, drop, preview, magnetism, and bring-to-front behaviors match native window workflows in managed mode.
  • Managed overlays replace native helper windows when managed mode is enabled.

Detailed spec

  • Window hosting and layout
    • DockSettings.UseManagedWindows switches floating windows to ManagedHostWindow.
    • ManagedHostWindow maps IDockWindow to ManagedDockWindowDocument and registers it with ManagedWindowDock.
    • DockControl registers ManagedWindowLayer per factory and renders managed windows via MdiDocumentWindow.
    • ManagedWindowLayer.LayoutManager drives MDI layout and z-order.
  • Drag, drop, and preview
    • Managed drag uses MDI coordinates without double translation.
    • Drop positions in managed mode are computed relative to the managed layer, avoiding screen offset errors.
    • Drag previews render inside ManagedWindowLayer for dockable drags and are suppressed when dragging a managed window itself.
    • Floating window creation respects managed content offsets for tools and documents.
  • Magnetism and activation
    • Window magnetism snaps managed windows using MdiBounds.
    • Bring-to-front updates managed z-order and activation when dragging starts.
  • Overlays and helpers
    • Dock adorners and pinned windows render in managed overlays when managed mode is active.
    • Service resolution and overlay helpers locate the managed layer for managed windows.

Usage example

using Dock.Avalonia.Controls;
using Dock.Settings;

DockSettings.UseManagedWindows = true;
DockSettings.EnableWindowMagnetism = true;
DockSettings.BringWindowsToFrontOnDrag = true;

var dockControl = new DockControl
{
    EnableManagedWindowLayer = true,
    HostWindowFactory = () => new ManagedHostWindow()
};

Custom template snippet (ensure the part exists):

<controls:ManagedWindowLayer x:Name="PART_ManagedWindowLayer"
                             IsVisible="False" />

Tests

  • tests/Dock.Avalonia.HeadlessTests/ManagedWindowParityTests.cs covers activation, z-order, drag preview behavior, managed drop offsets, overlay registration, and window magnetism in managed mode.

Fixes #677

Document managed window setup, behavior, and references.
Update windowing articles and table of contents.
Create DockReactiveUIManagedSample from ReactiveUI sample.
Enable managed windows by default.
Add the project to the samples solution list.
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.

Browser Support

1 participant