Sample applications for Windows development

This page is targeted at users who are looking for Windows development samples that demonstrate specific tasks, features, and API usage patterns.

The samples in this document demonstrate features from Windows App SDK / WinUI 3, UWP / WinUI 2, .NET MAUI, and more. See our Samples Browser for a more extensive catalog of samples.

Most of the samples identified in this document contain Solution (.sln) files that can be opened in Visual Studio. Refer to each resource's Readme for additional instructions.

Windows App SDK / WinUI 3 samples

Samples repositories

Samples repository Description
microsoft/WindowsAppSDK-Samples This is the main Windows App SDK samples repository.
WinUI 3 Gallery Showcases various WinUI 3 controls and how to effectively use them. See WinUI 3 Gallery in the Store.
Input & Composition Gallery Showcases a variety of Microsoft.UI.Composition and Microsoft.UI.Input API calls.

Samples that demonstrate specific tasks

Sample Task
Activation Handle app activation kinds. App activiation APIs control the way that your app handles activation kinds like Launch, File, and Protocol.
App Instancing Determine application instancing behavior. App instancing APIs control whether or not users can run multiple instances of your application at the same time.
Power Notifications Use state notifications. State notifications allow you to detect when the user's device enters specific states, such as low power mode.
Restart Programatically restart your app. This sample makes use of the Windows App SDK Restart APIs.
Resource Management Tailor your app to the user and device settings. MRT Core resource management APIs allow you to adapt resource utilization to specific situations.
Deployment Manager Call the Deployment API to ensure that Windows application framework components are up to date.
Installer Launch the Windows App SDK installer without using a console window.
TextRendering with DWriteCore Render text using DWriteCore APIs.
Unpackaged Windows App SDK deployment guide for framework-dependent apps packaged with external location or unpackaged, an alternative to packaged app deployment architecture.
Dynamic Dependencies Demonstrates the techniques shown in Use the dynamic dependency API to reference MSIX packages at run time.
Push Notifications Add push notifications to your app. Push Notifications can be used to send device-native app notifications to users.
App Notifications Add toast notifications to your app. See App Notifications to learn more.
Custom Controls Add custom C#/WinRT controls to your app using the patterns demonstrated in Author Windows Runtime components with C#/WinRT.
Windowing Add windowing support to your app to create/hide new windows, customize titlebars, and more. See Manage App Windows to learn more.

UWP / WinUI 2 samples

Samples repositories

Samples repository Description
microsoft/Windows-universal-samples This is the main UWP samples repository.
microsoft/DesktopBridgeToUWP-Samples Samples for framework conversion (e.g. Win32 -> UWP, etc).
WinUI 2 Gallery Showcases various WinUI 2 controls and how to effectively use them. See WinUI 2 Gallery in the Store.
Universal Windows Platform (UWP) app samples Demonstrates WinRT API usage patterns for UWP.

Samples that demonstrate specific tasks

Sample Task
360 Degree Video Playback Play a 360-degree video to give an immersive/explorative experience to your users.
Advanced Casting Use advanced casting to allow your users to share their content on other devices like TVs.
Animation Metrics Create Windows-styled designs via the AnimationMetrics API to keep your app consistent with Windows.
App Window Create new windows and control their positioning, size, or Picture-in-Picture mode.
Application Data Store user-unique data such as session states, preferences and other settings easily allowing it to be backed up to the cloud inside Windows.
Application Resources Store resources such as images, and strings, away from your app code allowing you to easily edit them at any time.
Appointments Create/manage appointments with Calendar app integration.
Association Launching Use association launching to associate your app with specific file types and protocols.
Audio Creation Use the audio APIs to load audio files, play audio, capture audio from other apps, apply effects to audio, and create custom effects.
Background Tasks Use Background Tasks to run specific events (like updating your app) whenever your app isn't running.
Basic Suspension Use the Suspension Manager to save/restore your app's state when the app is suspended or shut down.
Camera Starter Kit Use the MediaCapture APIs to stop/start camera previews, take pictures/videos, handle rotation, and adjust elements based on the angle of the camera.
Camera Frames Process individual camera frames or monitor when new cameras are connected.
Disabling Screen Capture Disable and Enable screen capture to protect sensitive in-app information.
File Access Use the Storage API to access files, read file properties, write data to files, and more.
File Picker Create file and directory pickers so your app can prompt users to select files and directories.
JSON Serialize and deserialize JSON objects returned from APIs.
PDF Document Display and modify PDFs via the the PDF namespace.
Title Bar Customize the title bar properties, colors, style, and controls.
WebSocket Use WebSockets to communicate with another app (or a browser page), avoiding the overhead of HTTP.

.NET MAUI samples

Samples repositories

Samples repository Description
dotnet/maui-samples .NET MAUI is a cross-platform framework for creating mobile and desktop apps with C# and XAML. Using .NET MAUI, you can develop apps that can run on Android, iOS, iPadOS, macOS, and Windows from a single shared codebase. These are also available in the Samples browser.
.NET Podcast app The .NET Podcast app is a sample application showcasing .NET 6, ASP.NET Core, Blazor, .NET MAUI, Azure Container Apps, Orleans, and more.

Samples that demonstrate specific tasks

Sample Name/Link Task
Animations Use animations to bring your app to life.
Behaviors Add functionality without subclassing using behaviors, instead attaching behavior classes to your controls.
Control Templates Define the visual structure of ContentView derived custom controls, and ContentPage derived pages.
Data Binding Bind objects to the actual UI elements, responsively updating one another when one changes.
Shell App Use a .NET Shell app to reduce complexity, reuse code, and integrate existing Windows functionality (such as URI navigation and integrated search bars) into your app.
Triggers Use triggers to selectively update, hide, or display specific controls when an event or data changes.

More Windows development samples repositories

Samples repository Description
Template Studio Accelerate the creation of apps using a wizard-based UI.
App Model Samples Contains sample apps that demonstrate the core application activation and lifecycle management infrastructure of various platforms such as the Universal Windows Platform (UWP), Windows Forms (WinForms), and console.
Windows classic samples Demonstrates a wide range of desktop app scenarios, including Win32, Windows Runtime (WinRT), and .NET.
Desktop Bridge to UWP samples Demonstrates the Desktop Conversion Extensions for converting desktop apps (such as Win32, Windows Presentation Foundation, and Windows Forms) and games to UWP apps and games.
DirectX 12 graphics samples Demonstrates how to build graphics-intensive apps on Windows using DirectX 12.
Windows Composition samples Demonstrates how to use types from the Windows.UI.Xaml and Windows.UI.Composition namespaces to make beautiful UWP apps.
Windows samples for IoT Sample apps to help you get started with developing for Windows on Devices.
Windows Community Toolkit A collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer tasks when building apps for Windows.
Windows task snippets Ready-to-use snippets of code that accomplish small but useful tasks of interest to UWP app developers. These snippets show simple solutions to common problems, and simple recipes to help you implement new app features.
Win2D Win2D is an easy-to-use Windows Runtime (WinRT) API for immediate-mode 2D graphics rendering with GPU acceleration. It's available to C# and C++ developers, and it utilizes the power of Direct2D, integrating seamlessly with XAML and CoreWindow.

Next steps