Windows Apps
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production; see the section bibliography for the reference material consulted while preparing these pages. |
Welcome to the Windows Apps reference. It teaches how to build Windows desktop applications with C# on .NET 10: the XAML language, WPF (the mature desktop UI framework, and the centre of this section), the MVVM pattern with the MVVM Toolkit, the newer WinUI 3 and Windows App SDK stack, Windows Forms, and the part that is often forgotten, which is how to publish and distribute the result — .NET publish options, MSIX, code signing, the Microsoft Store, WinGet, App Installer, ClickOnce and continuous delivery. Each of the 48 concept pages explains one idea in detail, with tables of every option, pitfalls, runnable examples and a link to the official page each example derives from.
The section was written against these versions, verified on 23 October 2026:
-
.NET 10 LTS, latest patch 10.0.13, supported until 14 November 2028, with C# 14. .NET 8 and .NET 9 end support on 10 November 2026. .NET 11 is at release candidate 2; general availability is expected at .NET Conf, 10 to 13 November 2026.
-
Visual Studio 2026, latest 18.11.1.
-
Windows App SDK 2.5.1 (stable channel) and CommunityToolkit.Mvvm 8.4.2.
-
Windows 11 and Windows 10. Windows 10 reached end of support on 14 October 2025.
The language itself is covered elsewhere: for delegates and events, async and await, threads, native interop, testing and
the dotnet CLI, see the C# Reference. This section adds what Windows
desktop development needs on top of it.
The Bookshelf Desktop scenario
Every example builds one application, Bookshelf Desktop, a Windows client for the Bookshelf domain used in other
sections of this site. It has a main window with a book list, a details pane, search and filtering, and add and edit
dialogs with validation. A BooksViewModel built with the MVVM Toolkit talks to an IBookRepository (Entity Framework
Core with SQLite) and to an IDialogService and an INavigationService, all registered in the Generic Host. The
application is themed in light and dark Fluent styles, localized in English and Spanish and given accessibility names.
The same main screen is re-implemented in WinUI 3 (x:Bind, NavigationView, Mica) and in Windows Forms
(BindingSource), so the stack-comparison pages can show the differences. It is published as framework-dependent and
self-contained builds, as an MSIX signed in CI, through an App Installer feed, as a WinGet manifest and as a Microsoft
Store submission. The scenario is original and not copied from any tutorial or book.
Choose your path
Pick the path that matches your goal. All paths start with the stack comparison and the environment setup.
The central pages
WPF, XAML, MVVM and publishing and distribution are the central topics. The pages below are the most detailed pages of the section, and each is worth reading in full:
Reading order
New to Windows desktop development? Read the Foundations and XAML pages first, then the WPF pages from top to bottom (they are in dependency order: layout and properties before binding, binding before templates), then MVVM, and finish with Publishing and distribution. The Other stacks and platform integration pages can be read at any point after the WPF pages, because they compare themselves with WPF. Already know WPF? Jump to MVVM or Publishing and distribution. The printable Cheat Sheet (PDF) summarises every concept on one A4 page.
Foundations
| Page | What it covers |
|---|---|
Windows App Platforms: WPF, WinUI 3, WinForms, MAUI & More (central) |
Which stack to choose: WPF, WinUI 3, Windows Forms, .NET MAUI, UWP and the rest, with a comparison table and the official recommendation. |
Developer Mode, Visual Studio 2026 workloads, winget configure, the winapp CLI, templates, XAML Hot Reload and the Live Visual Tree. |
|
Target frameworks, the UseWPF / UseWindowsForms / UseWinUI switches, app.manifest, solution layout and the build pipeline. |
XAML
| Page | What it covers |
|---|---|
XAML Language Fundamentals (central) |
Elements, attributes, content properties, type converters, namespaces, the x: directives, code-behind and BAML. |
How markup extensions are evaluated, the built-in ones, custom extensions and XAML namescopes. |
|
Resource lookup, StaticResource versus DynamicResource, merged dictionaries and pack URIs. |
|
What differs between WPF, WinUI and .NET MAUI XAML, and how to port markup. |
WPF
| Page | What it covers |
|---|---|
WPF Architecture & Application Model (central) |
The WPF layers, the class hierarchy, logical and visual trees, the Application object and its life cycle. |
Windows, modal dialogs, MessageBox, common dialogs, pages, frames and the navigation journal. |
|
Layout & Panels (central) |
The Measure and Arrange passes, Grid, StackPanel, DockPanel, WrapPanel, Canvas and custom panels. |
The control catalogue and the content model behind ContentControl and ItemsControl. |
|
ItemsControl, ListBox, ListView, DataGrid, TreeView and UI virtualization. |
|
Why dependency properties exist, value precedence, metadata, coercion and attached properties. |
|
Bubbling, tunnelling and direct events, handled events, input, focus and attached events. |
|
Commands (central) |
ICommand, routed commands, command bindings, input gestures and the built-in commands. |
Data Binding (central) |
Binding anatomy, modes, update triggers, sources, change notification, MultiBinding and debugging. |
Value converters, collection views for sorting, filtering and grouping, and data templates. |
|
ValidationRule, IDataErrorInfo, INotifyDataErrorInfo, error templates and DataAnnotations. |
|
Styles, Templates & Triggers (central) |
Styles, control templates, triggers and the Visual State Manager. |
The Fluent theme, ThemeMode, accent colours, dark mode and high contrast. |
|
UserControl versus templated controls, Themes/Generic.xaml and automation peers. |
|
Shapes, brushes, transforms, effects, storyboards, media and rendering tiers. |
|
FlowDocument, FixedDocument, XPS, printing and text rendering. |
|
Threading, the Dispatcher & Async (central) |
UI-thread affinity, the Dispatcher, async and await, cancellation and progress. |
HwndHost, WindowsFormsHost, WebView2, Blazor Hybrid, P/Invoke and CsWin32. |
|
Resources, culture switching, right-to-left layout and the English and Spanish Bookshelf example. |
|
UI Automation, AutomationProperties, keyboard navigation and accessibility testing. |
MVVM
| Page | What it covers |
|---|---|
The MVVM Pattern (central) |
Model, view and view model, binding as the glue, view-first versus ViewModel-first, and how other platforms compare. |
A hand-written ViewModelBase and RelayCommand, so the toolkit is not magic. |
|
The MVVM Toolkit (CommunityToolkit.Mvvm) (central) |
ObservableObject, partial-property [ObservableProperty], [RelayCommand], ObservableValidator and the generators. |
IMessenger, weak and strong messengers, tokens and request messages. |
|
Dependency Injection & the Generic Host (central) |
The Generic Host in WPF, service lifetimes, configuration, logging and view-model composition. |
INavigationService, IDialogService and file-picker services as user patterns. |
|
Testing View Models & UI (central) |
Unit-testing view models, fakes, async commands, validators and UI automation options. |
Other stacks and platform integration
| Page | What it covers |
|---|---|
WinUI 3 & the Windows App SDK (central) |
WinUI 3 project anatomy, x:Bind, NavigationView, Mica, AppWindow and the Windows App SDK. |
The designer, layout, BindingSource, high DPI, dark mode and the .NET 10 async APIs. |
|
.NET MAUI on Windows, UWP, Win32 and C++, React Native for Windows, PWAs and third-party options. |
|
Package identity, notifications, pickers, jump lists, the tray and other Windows features. |
|
Where data lives, settings, EF Core with SQLite, files and migrations. |
|
The MSIX container, capabilities, elevation, secrets and supply-chain basics. |
|
Startup, virtualization, binding costs, profiling, counters and crash reporting. |
Publishing and distribution
| Page | What it covers |
|---|---|
.NET Publishing Options (central) |
Framework-dependent, self-contained, single-file, ReadyToRun, trimming and Native AOT per stack. |
MSIX Packaging & Signing (central) |
MSIX, the manifest, packaging projects, certificates, SignTool and Artifact Signing. |
Distribution Channels (central) |
Microsoft Store, App Installer, WinGet, ClickOnce, MSI and EXE installers and SmartScreen. |
Version numbers, update mechanisms per channel and telemetry after App Center. |
|
Building, testing, packaging, signing and publishing with GitHub Actions. |
|
Moving WPF and Windows Forms from .NET Framework to .NET 10, and what is unavailable. |
|
The version snapshot of this section and what changed on each release clock. |
Stack chooser
The official guidance, from the Windows developer FAQ, is that WinUI 3 with the Windows App SDK is the recommended choice for new native Windows apps, that WPF and Windows Forms are mature and still maintained on current .NET, and that UWP is in maintenance. The Windows App Platforms: WPF, WinUI 3, WinForms, MAUI & More page has the full comparison; this table is the short version.
| Situation | Start with | Why | Read next |
|---|---|---|---|
A new Windows-only app that should look like Windows 11 |
WinUI 3 |
Fluent controls, Mica, |
|
A data-heavy line-of-business app, or a team that already knows XAML and WPF |
WPF |
The richest control and binding model, mature tooling, a Fluent theme since .NET 9, full .NET 10 support |
|
An existing Windows Forms app, or a quick utility with the designer |
Windows Forms |
Still maintained, dark mode and async APIs in .NET 10, the lowest ramp-up cost |
|
One codebase for Windows, macOS, iOS and Android |
.NET MAUI |
XAML on WinUI under the hood on Windows, with a single project for every target |
|
A UWP app, Win32 or C++ code, React Native for Windows or a PWA |
See the options page |
UWP is in maintenance; the other options have their own trade-offs |
|
Any stack, any size |
MVVM with the MVVM Toolkit |
The pattern that keeps the view model testable, shared across WPF, WinUI 3 and Windows Forms |
|
Moving a .NET Framework app forward |
.NET 10 on the same stack first |
WPF and Windows Forms both run on .NET 10, and the move does not require a new UI framework |
Related sections
-
The same MVVM idea on other platforms: Android app architecture, Apple app architecture, Kotlin Multiplatform shared view models and GWT MVP. The The MVVM Pattern page compares them.
-
Hosting web content in a desktop app: Blazor WebAssembly, Hybrid and deployment.
-
A parallel migration story: Migrating ASP.NET Web Forms to modern ASP.NET.
-
Parallel distribution guides: macOS distribution outside the App Store and Publishing on Google Play.
-
Running models on Windows: Hugging Face on Windows and .NET.
-
Command-line and terminal apps, including .NET console applications and Spectre.Console / Terminal.Gui TUIs, are covered in the CLI section.
-
The Visual Basic flavour of Windows Forms and WPF, the programming-languages comparison, the frameworks comparison and the DocFX section are tracked in separate issues (#280, #196, #263 and #247) and are mentioned here without links until they are published.
Book and official sources compared
Two Packt books were read while preparing this section. They are about .NET itself and about console applications, so they contribute to the publishing, distribution, dependency and testing pages, and nothing to the UI pages. The official Microsoft documentation is the source for everything else, and it wins wherever the two differ.
| Concept the books contribute | Page | What the page does with it |
|---|---|---|
Framework-dependent versus self-contained builds, single-file, |
Takes the publish properties and adds the per-stack matrix: trimming and Native AOT are unsupported for WPF and Windows Forms |
|
WPF and Windows Forms publish like console apps, but only to Windows (Price) |
States it, then adds the Windows-specific pieces (RIDs, MSIX, ClickOnce) |
|
Debugging, Hot Reload, unit testing with xUnit (Price, chapter 4) |
Development Environment & Tooling and Testing View Models & UI |
Uses Visual Studio 2026 tooling and view-model tests with fakes |
Events, interfaces and generics behind |
Links to the C# Reference pages instead of repeating the language |
|
EF Core with SQLite and LINQ (Price, chapters 10 and 11) |
Builds the Bookshelf repository on them |
|
Avalonia and .NET MAUI as cross-platform alternatives (Price) |
Names Avalonia and Uno Platform as third-party options without tutorials |
|
Distribution options: MSI with WiX, .NET tool, Docker, WinGet; |
Uses them and adds what the book lacks: MSIX, signing, SmartScreen and the Store |
|
Dependency inversion and DI-based modular structure (Belmansour, chapter 8) |
Applies it to the Generic Host in a desktop app |
|
Test types and mocking external dependencies (Belmansour, chapter 10) |
Applies it to view models, services and repositories |
|
Instrumenting and profiling, security posture (Belmansour, chapters 12 and 13) |
Adds the Windows tools: Visual Studio profiler, |
Where the books are outdated or out of scope, the pages follow the official documentation:
-
Both books target .NET 9, which leaves support on 10 November 2026. This section uses .NET 10 LTS.
-
The Native AOT section of the Price book is about console apps. Native AOT and trimming are not supported for WPF and Windows Forms; WinUI documents
PublishAotonly in its release notes. -
The Belmansour chapter on WinGet does not discuss code signing or MSIX. The distribution pages add signing, SmartScreen and Store requirements from the official documentation. WinGet itself does not require a signed installer; the signing discussion is there because unsigned installers are flagged by SmartScreen.
-
Neither book covers XAML, WPF, MVVM, WinUI, MSIX, the Microsoft Store or ClickOnce, so those pages rely on the official documentation alone.
-
The CLI-specific chapters (argument parsing,
System.CommandLine, interactive CLIs) belong to the CLI section, not to this section.
The official documentation also has gaps, and the pages say so instead of inventing APIs: there is no Microsoft Learn MVVM article written for WPF, no official ViewModel-first navigation or dialog service, no official guidance on testing WPF view models, no conceptual WPF Ribbon page, no Native AOT or trimming support for WPF and Windows Forms, and no current Microsoft recommendation for desktop UI-test automation.
Bibliography
This is the list of sources used to prepare the pages of this section. Every entry links to the publisher’s or
project’s own site, and each page lists the subset it used under its own == References heading. All Microsoft Learn,
GitHub and project links were checked with an automated request on 23 October 2026. The two Packt links and the NSIS
site are the exceptions: they answer automated requests with a bot-protection response (HTTP 403), and a browser check
of the Packt pages reached the same challenge page, so those three could not be confirmed automatically and should be
opened by hand.
Books
The two books were read for the topics they cover (publishing, packaging, WinGet, dependency inversion, testing and profiling). Neither covers XAML, WPF, MVVM, WinUI, MSIX, the Microsoft Store or ClickOnce, and both target .NET 9, so the pages follow the official documentation where they differ. The books are never quoted.
-
Mark J. Price, C# 13 and .NET 9 - Modern Cross-Platform Development Fundamentals, 9th edition, Packt, 2024, ISBN 978-1-83588-122-4: Packt product page
-
Tidjani Belmansour, Building CLI Applications with C# and .NET, 1st edition, Packt, 2025, ISBN 978-1-83588-274-0: Packt product page
Official documentation: Windows app development (Microsoft Learn)
Windows apps hub, get started and FAQ, WinUI 3, the Windows App SDK and its release channels, data binding and MVVM,
x:Bind, WinUI XAML, windowing, app lifecycle, notifications, MRT Core, Windows AI APIs, design and accessibility
pages, the winapp CLI, Developer Mode and the status of UWP.
-
Data binding with WinUI and MVVM Toolkit, step 3: add dependency injection
-
Deployment guide for apps packaged with external location or unpackaged
-
Grant package identity by packaging with external location manually
-
Localize strings in your UI and app package manifest (MRT Core)
-
Modernize packaged desktop apps (features that require package identity)
-
Test apps built with the Windows App SDK and WinUI 3 (testing hub)
Official documentation: WPF, XAML and Windows Forms
The WPF documentation (every sub-page used, including the Generic Host how-to and the what’s-new pages for .NET 7 to 11), XAML services, the Windows Forms documentation, .NET MAUI, WebView2, UI Automation, Accessibility Insights, and the dotnet/wpf and dotnet/winforms sources.
Official documentation: MVVM
The MVVM Toolkit documentation (every sub-page used), CommunityToolkit.Mvvm on NuGet with its releases and samples, the Enterprise Application Patterns e-book, the Generic Host, dependency injection and XAML Behaviors for WPF.
-
Communicating Between Components (Enterprise Application Patterns Using .NET MAUI)
-
Dependency injection (Enterprise Application Patterns Using .NET MAUI)
-
Model-View-ViewModel (Enterprise Application Patterns Using .NET MAUI)
-
Navigation (Enterprise Application Patterns Using .NET MAUI)
-
Unit testing (Enterprise Application Patterns Using .NET MAUI)
-
Validation (Enterprise Application Patterns Using .NET MAUI)
Official documentation: publishing and distribution
dotnet publish, the package-and-deploy hub, choosing a distribution path, the distribution featurestatus, MSIX, single-project MSIX, App Installer, code signing options, Azure Artifact Signing, SignTool, SmartScreen reputation, Microsoft Store publishing, the developer account and the Store Policies, the Windows App Certification Kit, WinGet with winget-pkgs and wingetcreate, ClickOnce, CI for WinUI and GitHub Actions.
Official documentation: tooling, testing and support policy
The .NET support policy, the Visual Studio 2026 release notes, XAML Hot Reload, the Live Visual Tree, unit testing with MSTest and on WinUI, WinAppDriver, GitHub Copilot app modernization, diagnostics tools, Entity Framework Core and Semantic Versioning.