NuExt.Minimal.Mvvm.AvalonDock integrates AvalonDock with NuExt.Minimal.Mvvm.Wpf, providing MVVM infrastructure for dockable documents and tool windows.
- WPF on .NET 8/9/10/11 and .NET Framework 4.8+
- AvalonDock 5
Via NuGet:
dotnet add package NuExt.Minimal.Mvvm.AvalonDockOr via Visual Studio:
- Go to
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.... - Search for
NuExt.Minimal.Mvvm.AvalonDock. - Click Install.
NuExt.Minimal.Mvvm.SourceGeneratorremoves ViewModel and command boilerplate at compile time.
Attach the required services to an AvalonDock docking manager:
<avalonDock:DockingManager>
<nx:Interaction.Behaviors>
<nx:AvalonDockDocumentService x:Name="Documents" />
<nx:AvalonDockToolWindowService x:Name="Tools" />
</nx:Interaction.Behaviors>
</avalonDock:DockingManager>The services are available to ViewModels as named services:
public IAsyncDocumentManagerService DocumentManagerService =>
GetRequiredService<IAsyncDocumentManagerService>("Documents");
public IAsyncToolWindowManagerService ToolWindowManagerService =>
GetRequiredService<IAsyncToolWindowManagerService>("Tools");IToolWindow toolWindow = await ToolWindowManagerService.CreateToolWindowAsync(
toolWindowType: nameof(PropertiesView),
viewModelFactory: static () => new PropertiesViewModel(),
parentViewModel: this,
parameter: null,
options: new ToolWindowOptions
{
Id = "Properties",
Title = "Properties",
Placement = ToolWindowPlacement.Left,
CanFloat = false,
CanDockAsTabbedDocument = false
},
cancellationToken: cancellationToken);
toolWindow.Show();Tool windows are long-lived UI panels. Show() displays and activates a panel, while Hide() hides or collapses it without disposing its ViewModel. The tool window manager owns created ViewModels and disposes them during service cleanup.
A tool window can be retrieved by its identifier:
ToolWindowManagerService.FindToolWindowById("Properties")?.Show();AvalonDockToolWindowService supports ToggleDockingManager:
<avalonDock:ToggleDockingManager>
<nx:Interaction.Behaviors>
<nx:AvalonDockDocumentService x:Name="Documents" />
<nx:AvalonDockToolWindowService x:Name="Tools" />
</nx:Interaction.Behaviors>
</avalonDock:ToggleDockingManager>Tool windows managed by ToggleDockingManager must be created before the manager is loaded. Their initial side is configured through ToolWindowOptions.Placement.
- NuExt.Minimal.Mvvm
- NuExt.Minimal.Mvvm.SourceGenerator
- NuExt.Minimal.Behaviors.Wpf
- NuExt.Presentation.Wpf
- NuExt.Minimal.Mvvm.Wpf
- NuExt.Minimal.Mvvm.MahApps.Metro
- NuExt.System
- NuExt.System.Data
- NuExt.System.Data.SQLite
Issues and PRs are welcome. Keep changes minimal and performance-conscious.
MIT. See LICENSE.