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.

flowchart TD start["Start: set up Visual Studio 2026 and .NET 10"] --> goal{"What is your goal?"} goal -->|"Build a classic desktop app"| wpf["WPF path: XAML, layout, binding, commands, templates"] goal -->|"Structure the code well"| mvvm["MVVM path: pattern, MVVM Toolkit, DI, testing"] goal -->|"Use the newest native stack"| winui["WinUI path: WinUI 3, Windows App SDK, platform integration"] goal -->|"Maintain a Windows Forms app"| winforms["Windows Forms on .NET: designer, binding, dark mode"] goal -->|"Ship what I built"| publish["Publishing path: publish options, MSIX, channels, CI/CD"] wpf --> mvvm mvvm --> publish winui --> publish winforms --> publish publish --> done["Signed, versioned and distributed app"]

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.

Development Environment & Tooling

Developer Mode, Visual Studio 2026 workloads, winget configure, the winapp CLI, templates, XAML Hot Reload and the Live Visual Tree.

Project Structure & Build

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.

Markup Extensions & Namescopes

How markup extensions are evaluated, the built-in ones, custom extensions and XAML namescopes.

Resources & Resource Dictionaries

Resource lookup, StaticResource versus DynamicResource, merged dictionaries and pack URIs.

XAML Dialects: WPF, WinUI & MAUI

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, Dialogs & Navigation

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.

Controls & the Content Model

The control catalogue and the content model behind ContentControl and ItemsControl.

Lists, Grids & Trees

ItemsControl, ListBox, ListView, DataGrid, TreeView and UI virtualization.

Dependency Properties & Attached Properties (central)

Why dependency properties exist, value precedence, metadata, coercion and attached properties.

Routed Events & Input

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.

Converters, Collection Views & Data Templates

Value converters, collection views for sorting, filtering and grouping, and data templates.

Validation

ValidationRule, IDataErrorInfo, INotifyDataErrorInfo, error templates and DataAnnotations.

Styles, Templates & Triggers (central)

Styles, control templates, triggers and the Visual State Manager.

Themes & Fluent Design

The Fluent theme, ThemeMode, accent colours, dark mode and high contrast.

User Controls & Custom Controls

UserControl versus templated controls, Themes/Generic.xaml and automation peers.

Graphics, Animation & Multimedia

Shapes, brushes, transforms, effects, storyboards, media and rendering tiers.

Documents, Printing & Text

FlowDocument, FixedDocument, XPS, printing and text rendering.

Threading, the Dispatcher & Async (central)

UI-thread affinity, the Dispatcher, async and await, cancellation and progress.

Interop: Win32, WinForms & Web Content

HwndHost, WindowsFormsHost, WebView2, Blazor Hybrid, P/Invoke and CsWin32.

Globalization & Localization

Resources, culture switching, right-to-left layout and the English and Spanish Bookshelf example.

Accessibility & UI Automation

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.

MVVM from Scratch

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.

Messaging Between View Models

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.

Navigation, Dialogs & Services in MVVM

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.

Windows Forms on .NET

The designer, layout, BindingSource, high DPI, dark mode and the .NET 10 async APIs.

.NET MAUI, UWP & Other Options

.NET MAUI on Windows, UWP, Win32 and C++, React Native for Windows, PWAs and third-party options.

Windows Platform Integration

Package identity, notifications, pickers, jump lists, the tray and other Windows features.

Local Data, Settings & Files

Where data lives, settings, EF Core with SQLite, files and migrations.

Security & App Isolation

The MSIX container, capabilities, elevation, secrets and supply-chain basics.

Performance & Diagnostics

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.

Updates, Versioning & Telemetry

Version numbers, update mechanisms per channel and telemetry after App Center.

CI/CD with GitHub Actions

Building, testing, packaging, signing and publishing with GitHub Actions.

Migrating from .NET Framework

Moving WPF and Windows Forms from .NET Framework to .NET 10, and what is unavailable.

What’s New & Version History

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, AppWindow, the active investment of the Windows team, MSIX and Store integration

WinUI 3 & the Windows App SDK

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

WPF Architecture & Application Model

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

Windows Forms on .NET

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

.NET MAUI, UWP & Other Options

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

.NET MAUI, UWP & Other Options

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

The MVVM Pattern

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

Migrating from .NET Framework

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, DebugType embedded, trimming, Native AOT, dotnet workload (Price, chapter 7)

.NET Publishing Options

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)

.NET Publishing Options

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 INotifyPropertyChanged and ICommand (Price, chapter 6)

Data Binding

Links to the C# Reference pages instead of repeating the language

EF Core with SQLite and LINQ (Price, chapters 10 and 11)

Local Data, Settings & Files

Builds the Bookshelf repository on them

Avalonia and .NET MAUI as cross-platform alternatives (Price)

.NET MAUI, UWP & Other Options

Names Avalonia and Uno Platform as third-party options without tutorials

Distribution options: MSI with WiX, .NET tool, Docker, WinGet; wingetcreate new, update and submit; LocalManifestFiles; semantic versioning and rollback (Belmansour, chapter 11)

Distribution Channels and Updates, Versioning & Telemetry

Uses them and adds what the book lacks: MSIX, signing, SmartScreen and the Store

Dependency inversion and DI-based modular structure (Belmansour, chapter 8)

Dependency Injection & the Generic Host

Applies it to the Generic Host in a desktop app

Test types and mocking external dependencies (Belmansour, chapter 10)

Testing View Models & UI

Applies it to view models, services and repositories

Instrumenting and profiling, security posture (Belmansour, chapters 12 and 13)

Performance & Diagnostics and Security & App Isolation

Adds the Windows tools: Visual Studio profiler, dotnet-counters, the MSIX container

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 PublishAot only 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.

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.

Official documentation: publishing and distribution

NET deployment and dotnet publish, the package-and-deploy hub, choosing a distribution path, the distribution feature

status, 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.