Dock ships with a set of factory libraries that adapt the base model to various
MVVM frameworks. Dock.Model.Avalonia
provides a plain Avalonia version,
Dock.Model.Mvvm
adds INotifyPropertyChanged
helpers and
Dock.Model.ReactiveUI
wraps the same API with ReactiveUI types. You can create
your own implementation when these do not fit your application or you wish to
integrate Dock with another framework.
Dock.Model
.Dock.Model.Core
and Dock.Model.Controls
using the base classes that match your framework. The existing
implementations in the repository are good starting points.Factory
from Dock.Model.FactoryBase
and override the creation
methods (CreateRootDock
, CreateToolDock
, CreateDocumentDock
and so on)
to return your custom view models.ICommand
objects or ReactiveUI commands.A minimal dockable using INotifyPropertyChanged
might look like this:
public class MyDockable : DockableBase, INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string? name = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
Your factory can then create instances of MyDockable
and initialize them using
InitLayout
just like the built‑in MVVM and ReactiveUI versions. The
interfaces and helper methods in FactoryBase
remain the same regardless of the
underlying framework.
The easiest way to start is to copy the sources of Dock.Model.Mvvm
or
Dock.Model.ReactiveUI
and replace the command and property change types with
those from your own framework. Only a handful of classes need to be adjusted,
mainly the Dockable
bases and the Factory
implementation.
Custom implementations let you integrate Dock with any MVVM pattern while keeping the docking logic intact. Follow the structure of the provided models and adapt the base classes to match your chosen framework.
For an overview of all guides see the documentation index.