Skip to content

About

WinUI Gallery (WinUI 3) with dual UWP and packaged Win32 entry points, built on Windows App SDK.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Β 
Β 

Repository files navigation

WinUI Gallery hero image

WinUI Gallery

Companion app for WinUI & Windows App SDK APIs

This app demonstrates all of the WinUI 3 controls and styles available to make a modern Windows app with the Windows App SDK. It is the interactive companion to the Fluent Design guidelines and shows the usage of WinUI through interactive samples, tools and code snippets.

Important

This repository is a modified fork of microsoft/WinUI-Gallery, converted to a single-package, single-executable dual-entry app:

Contract AUMID suffix Runtime
UWP !App WinUI 3 in a UWP AppContainer (CoreWindow + PLM)
Win32 !Win32 Packaged classic full-trust Win32

The UWP host follows the experimental themerror/WinUI3-on-UWP technique. It relies on the undocumented HKLM\SOFTWARE\Microsoft\WinUI\Xaml\EnableUWPWindow=1 switch and is intended for research only.

WinUI Gallery

⭐ Features

  • WinUI controls samples: each control page shows the markup and codebehind used to create each example.

  • Use the Microsoft.UI.Xaml (WinUI) library: the app includes the latest WinUI NuGet package and shows how to use the WinUI controls like NavigationView, SwipeControl, and more.

  • Adaptive UI: in addition to showing how each control responds to different form factors, the app itself is responsive and shows various methods for achieving adaptive UI.

  • Design & accessibility guidance: design and accessibility pages help make the gallery a useful developer companion app.

πŸ”€ Dual-entry architecture (this fork)

  • Program.cs selects the UWP or Win32 contract with AppPolicyGetWindowingModel; the EnableUWPWindow registry check applies only to UWP.
  • GalleryShell hosts the shared NavigationView, Frame, title bar and navigation logic.
  • MainWindow is the Win32 Window host; the UWP path stores the shell in Window.Current.Content.
  • Both Package.appxmanifest and Package.Dev.appxmanifest declare App (UWP) and Win32 (windows.fullTrustApplication) entries.
  • PLM lifecycle is handled through CoreApplication events and SuspensionManager; the root frame is registered as AppFrame.
  • UWP title-bar drag regions use the CoreWindow ICoreWindowInterop HWND and InputNonClientPointerSource caption/passthrough regions.
  • The Home page title shows WinUI Gallery on WindowsApp(UWP) or WinUI Gallery on PackagedClassicApp for the active contract.

Runtime contracts

Entry Trust / runtime Title bar Notes
!App UWP AppContainer, CoreWindow, PLM UWP extended title bar with manual drag/passthrough regions Research mode; typed text input unavailable
!Win32 Packaged full trust, classic Win32 Window Mica + Window.SetTitleBar Full desktop behavior; use for text entry

Known limitations in the UWP contract

  • Typed text input is not available: text controls can paste but cannot receive typed characters. Use the !Win32 entry for text entry.
  • WinUI 3 MicaBackdrop/SystemBackdrop is not implemented in UWP mode; the theme acrylic brush is used as a fallback.
  • TabularControlsResources and XamlChartsResources are omitted because their resources are not available to the UWP AppContainer; those experimental sample pages are unavailable.
  • Desktop-only samples such as multi-window, AppWindow title bar and modal window may not work.
  • Title-bar passthrough hit testing can be unreliable; use the title-bar background drag region.

πŸ‘ Contribute to WinUI Gallery

Any samples or docs improvements you'd like to see? We're always looking for a helping hand. Feel free to file an issue to start the discussion, or even better, create a PR with the change you'd like to see!

Check out these help wanted issues if you don't know where to start.

You can also learn more about current happenings with WinUI Gallery in the project board.

πŸš€ Getting started

Quick start guide to building the WinUI Gallery:

1. Set up the environment

Note

The WinUI Gallery requires Visual Studio 2026 or the winapp CLI to build and Windows 10 or later to execute. If you're building an app with WinUI and Windows App SDK for the first time, follow these installation instructions.

Visual Studio 2026: install the WinUI application development workload.

winapp CLI: enable Developer Mode, install the .NET 10 SDK, and install the CLI:

winget install --id Microsoft.WinAppCli --exact --source winget

2. Clone the Repository

git clone https://github.com/themerror/WinUI-Gallery.git

Upstream Microsoft repository: https://github.com/microsoft/WinUI-Gallery.git.

3. Build and run

Visual Studio: open WinUIGallery.slnx, make sure WinUIGallery is set as the startup project, and press F5.

winapp CLI: from the repository root, run:

winapp run WinUIGallery\WinUIGallery.csproj

Gallery uses an experimental Windows App SDK to demonstrate upcoming features. Use the normal Debug or Release configuration; the SDK version is pinned in standalone.props. In this fork, packaged builds are framework-dependent on Microsoft.WindowsAppRuntime.2-experimentalF 2.5.4 so the WinUI activation classes are registered for the UWP contract; unpackaged builds remain self-contained. Experimental APIs can change or be removed before a stable release.

The Windowing APIs page combines stable window creation with experimental window sizing examples. Each experimental example has its own label and warning; the stable example retains its original APIs.

4. Build and run this fork

The fork targets Windows 10 1809+ and requires Developer Mode. The UWP contract also requires the registry switch from the reference repository (run as Administrator):

reg import ..\WinUI3-on-UWP\Enable-UWPWindow.reg

Publish the unsigned package:

dotnet publish WinUIGallery\WinUIGallery.csproj `
  -c Debug -p:Platform=x64 `
  -p:AppxBundle=Never `
  -p:BuildAllAppFlavors=false `
  -p:AppxPackageSigningEnabled=false

Register the extracted layout in Developer Mode:

$dir = ".\pkg"
New-Item -ItemType Directory -Path $dir -Force | Out-Null
$msix = Get-ChildItem .\WinUIGallery\AppPackages\WinUIGallery_3.0.0.0_x64_Debug_Test\*.msix | Select-Object -First 1
tar -xf $msix.FullName -C $dir
Add-AppxPackage -Register "$dir\AppxManifest.xml"

Launch either contract:

$pfn = "Microsoft.WinUI3ControlsGallery.Debug_8wekyb3d8bbwe"
Start-Process "shell:AppsFolder\$pfn!App"     # UWP
Start-Process "shell:AppsFolder\$pfn!Win32"   # Win32

The package is framework-dependent on Microsoft.WindowsAppRuntime.2-experimentalF 2.5.4; install the matching Windows App Runtime first. The MSIX is unsigned in this workflow; for normal deployment sign it with a certificate that matches the manifest Publisher.

Warning

Try deleting nuget.config and building again if you get the following build error:

Assets file 'C:\Users\...\source\repos\WinUI-Gallery\WinUIGallery\obj\WinUIGallery\project.assets.json' not found. Run a NuGet package restore to generate this file.

See issue #1659: Broken repo build.

➑️ Further information

To learn more about Windows app development, go to the Windows Dev Center.

Maintainers can follow the release runbook to coordinate Microsoft Store publishing with a GitHub release.

Related topics

πŸ“„ License and attribution

See LICENSE for the full MIT terms and modification notice.

πŸ† Contributors

Thanks to our amazing contributors!

WinUI Gallery Contributors

Made with contrib.rocks.

About

WinUI Gallery (WinUI 3) with dual UWP and packaged Win32 entry points, built on Windows App SDK.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages