Dock can detach dockables into separate floating windows. These windows are represented by the IDockWindow
interface and hosted using IHostWindow
implementations.
FactoryBase
exposes a CreateWindowFrom
method which returns an IHostWindow
. Override this method on your factory to customize the platform window used for floating docks:
public override IHostWindow CreateWindowFrom(IDockWindow source)
{
var window = base.CreateWindowFrom(source);
window.Title = $"Dock - {source.Id}";
return window;
}
Calling FloatDockable
on the factory opens a dockable in a new window. The returned IDockWindow
stores its bounds and title and can be serialized together with the layout.
IDockWindow
exposes Present(bool isDialog)
to show the window and Exit()
to close it programmatically. The default implementation uses HostAdapter
to bridge between the interface and the underlying Avalonia Window
.
Use the WindowOpened
and WindowClosed
events on the factory to track when floating windows appear or disappear.
factory.WindowClosed += (_, e) =>
Console.WriteLine($"Closed {e.Window?.Title}");
For more advanced scenarios see Adapter Classes and the Advanced Guide.