Copy a self-contained sample project as a starting point when learning how a specific WPF API like data binding or animations works.
Run individual samples in Visual Studio to see a working example of a WPF feature before adding it to your own app.
Use the accessibility-updated samples as a reference when updating an existing WPF app to meet accessibility standards.
Requires Visual Studio 2026 and the .NET 10 SDK, a small number of samples with C++ code must be built with MSBuild rather than the dotnet CLI.
This repository is a collection of code samples for Windows Presentation Foundation, commonly abbreviated as WPF. WPF is a Microsoft framework for building desktop applications on Windows, covering things like windows, buttons, menus, data tables, and custom controls. The samples here are maintained by Microsoft and demonstrate how to use specific features of the framework in C#. The collection was originally hosted on Microsoft's MSDN documentation site and has been migrated to GitHub over time. Each sample is a small, self-contained project focused on illustrating one concept, such as data binding, animations, layout panels, or text editing. The README notes that while the samples are useful for understanding specific APIs, some of them do not follow accessibility best practices, a smaller subset of samples has been updated to demonstrate those practices separately. All samples in the main branch target .NET 10, which requires Visual Studio 2026 and the .NET 10 SDK to build. Older branches targeting .NET 8 and .NET 9 are available for those still on earlier versions of the framework. Most samples can be built and run independently without needing the rest of the repository. To use the samples, you can either clone the repository with Git and open the provided solution file in Visual Studio, or download the whole repository as a ZIP file and open it from there. A small number of samples include C++ code and must be built with MSBuild or Visual Studio rather than the standard dotnet command-line tool. WPF itself is open source and developed in a separate GitHub repository under the dotnet organization.
← microsoft on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.