VirtualDesktop.WinForms 5.0.5

.NET 5.0
dotnet add package VirtualDesktop.WinForms --version 5.0.5
NuGet\Install-Package VirtualDesktop.WinForms -Version 5.0.5
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="VirtualDesktop.WinForms" Version="5.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VirtualDesktop.WinForms --version 5.0.5
#r "nuget: VirtualDesktop.WinForms, 5.0.5"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install VirtualDesktop.WinForms as a Cake Addin
#addin nuget:?package=VirtualDesktop.WinForms&version=5.0.5

// Install VirtualDesktop.WinForms as a Cake Tool
#tool nuget:?package=VirtualDesktop.WinForms&version=5.0.5


VirtualDesktop is C# wrapper for IVirtualDesktopManager on Windows 11 (and Windows 10).

Build Nuget (with prereleases) License


  • Switch, add, and remove a virtual desktop.
  • Move the window in the same process to any virtual desktop.
  • Move the window of another process to any virtual desktop (Support in version 2.0 or later).
  • Pin any window or application; will be display on all desktops.
  • Notification for switching, deletion, renaming, etc.
  • Change the wallpaper for each desktop.

Sample app



  • .NET 5 or 6
  • Windows 10 build 19041 (20H1) or later


Install NuGet package(s).

PM> Install-Package VirtualDesktop

How to use


Because of the dependency on C#/WinRT (repo), the target framework must be set to net5.0-windows10.0.19041.0 or later.


If it doesn't work, try creating an app.manifest file and optimize to work on Windows 10.

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
	    <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />

The namespace to use is WindowsDesktop.

using WindowsDesktop;

Get instance of VirtualDesktop class

// Get all virtual desktops
var desktops = VirtualDesktop.GetDesktops();

// Get Virtual Desktop for specific window
var desktop = VirtualDesktop.FromHwnd(hwnd);

// Get the left/right desktop
var left  = desktop.GetLeft();
var right = desktop.GetRight();

Manage virtual desktops

// Create new
var desktop = VirtualDesktop.Create();

// Remove

// Switch

Subscribe virtual desktop events

// Notification of desktop switching
VirtualDesktop.CurrentChanged += (_, args) => Console.WriteLine($"Switched: {args.NewDesktop.Name}");

// Notification of desktop creating
VirtualDesktop.Created += (_, desktop) => desktop.Switch();

for WPF window

// Need to install 'VirtualDesktop.WPF' package

// Check whether a window is on the current desktop.
var isCurrent = window.IsCurrentVirtualDesktop();

// Get Virtual Desktop for WPF window
var desktop = window.GetCurrentDesktop();

// Move window to specific Virtual Desktop

// Pin window

See also:


This library is under the MIT License.

Product Versions
.NET net5.0-windows10.0.19041 net6.0-windows10.0.19041
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.5 341 2/7/2022
5.0.4 212 2/6/2022
5.0.2 199 2/6/2022
5.0.1 197 2/5/2022
5.0.0 196 2/5/2022
4.0.1 684 3/22/2020
4.0.0 488 3/22/2020
1.0.3 1,593 12/15/2015
1.0.2 843 12/15/2015
1.0.1 819 12/15/2015
1.0.0 798 12/15/2015