WinUI.Dock
2.0.0
dotnet add package WinUI.Dock --version 2.0.0
NuGet\Install-Package WinUI.Dock -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WinUI.Dock" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WinUI.Dock" Version="2.0.0" />
<PackageReference Include="WinUI.Dock" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WinUI.Dock --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WinUI.Dock, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WinUI.Dock@2.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WinUI.Dock&version=2.0.0
#tool nuget:?package=WinUI.Dock&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WinUI.Dock
WinUI.Dock is a docking control similar to Visual Studio, based on WinUI 3. Its design is inspired by AvalonDock and ImGui.
Supported Platforms
- WinUI 3.0
- Uno Platform (partially available)
Preview
WinUI | Uno |
---|---|
![]() |
![]() |
![]() |
![]() |
Quick Start
- Install the NuGet package
Install-Package WinUI.Dock
- Add the DockManager control in MainView.xaml
xmlns:dock="using:WinUI.Dock"
<dock:DockManager x:Name="Manager"
Grid.Row="1"
Adapter="{Binding}"
Behavior="{Binding}">
<dock:LayoutPanel Orientation="Vertical">
<dock:LayoutPanel Orientation="Horizontal">
<dock:DocumentGroup ShowWhenEmpty="True">
<dock:Document Title="MainView.xaml"
CanClose="True">
<Button VerticalAlignment="Top"
Command="{Binding OpenPropertiesCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}}"
Content="Open Properties" />
</dock:Document>
<dock:Document Title="MainViewModel.cs"
CanClose="True" />
</dock:DocumentGroup>
<dock:DocumentGroup Width="200"
CompactTabs="True"
TabPosition="Bottom">
<dock:Document Title="Bottom##Solution Explorer"
CanClose="True"
CanPin="True" />
<dock:Document Title="Bottom##Git Changes"
CanClose="True"
CanPin="True" />
</dock:DocumentGroup>
</dock:LayoutPanel>
<dock:LayoutPanel Height="200"
Orientation="Horizontal">
<dock:DocumentGroup TabPosition="Bottom">
<dock:Document Title="Bottom##Error List"
CanClose="True"
CanPin="True" />
</dock:DocumentGroup>
<dock:DocumentGroup CompactTabs="True"
TabPosition="Bottom">
<dock:Document Title="Bottom##Output"
CanClose="True"
CanPin="True" />
<dock:Document Title="Bottom##Terminal"
CanClose="True"
CanPin="True" />
</dock:DocumentGroup>
</dock:LayoutPanel>
</dock:LayoutPanel>
</dock:DockManager>
- Implement the Adapter and Behavior interfaces in MainViewModel.cs
public partial class MainViewModel : ObservableObject, IDockAdapter, IDockBehavior
{
private readonly Document propertiesDocument = new()
{
Title = "Bottom##Properties",
Content = "This is a properties document.",
CanClose = true
};
[RelayCommand]
private void OpenProperties(object content)
{
propertiesDocument.Width = 200;
propertiesDocument.DockTo(DocumentHelpers.GetDocument(content)!, DockTarget.SplitRight);
}
void IDockAdapter.OnCreated(Document document)
{
document.Content = new TextBlock()
{
Text = document.ActualTitle,
FontSize = 14,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
}
void IDockAdapter.OnCreated(DocumentGroup group, Document? draggedDocument)
{
if (draggedDocument?.Title.Contains("Bottom##") is true)
{
group.TabPosition = TabPosition.Bottom;
}
}
object? IDockAdapter.GetFloatingWindowTitleBar(Document? draggedDocument)
{
return new TextBlock()
{
IsHitTestVisible = false,
Text = "Example Floating Window",
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
FontSize = 16,
FontWeight = FontWeights.Bold
};
}
void IDockBehavior.ActivateMainWindow()
{
App.MainWindow.Activate();
}
void IDockBehavior.OnDocked(Document src, DockManager dest, DockTarget target)
{
Debug.WriteLine($"Document '{src.ActualTitle}' docked to DockManager at target '{target}'.");
}
void IDockBehavior.OnDocked(Document src, DocumentGroup dest, DockTarget target)
{
Debug.WriteLine($"Document '{src.ActualTitle}' docked to DocumentGroup at target '{target}'.");
}
void IDockBehavior.OnFloating(Document document)
{
Debug.WriteLine($"Document '{document.ActualTitle}' is now floating.");
}
}
- Run the program to see the effect.
Known Issues
- Limited MVVM support - I don't have a good solution for data source binding (document and layout creation).
- Uno Platform's support for custom windows and cross-window drag-and-drop remains limited.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net9.0-windows10.0.19041 is compatible. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- CommunityToolkit.WinUI.Controls.LayoutTransformControl (>= 8.2.250402)
- CommunityToolkit.WinUI.Controls.Sizers (>= 8.2.250402)
- Uno.Fonts.Fluent (>= 2.7.1)
- Uno.WinUI (>= 6.1.34)
-
net9.0-windows10.0.19041
- CommunityToolkit.WinUI.Controls.LayoutTransformControl (>= 8.2.250402)
- CommunityToolkit.WinUI.Controls.Sizers (>= 8.2.250402)
- Microsoft.WindowsAppSDK (>= 1.7.250606001)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.