explaingit

microsoft/wpf-samples

5,678C#Audience · developerComplexity · 1/5Setup · easy

TLDR

Microsoft's official collection of small, self-contained code examples showing how to use specific WPF features for building Windows desktop apps in C#, covering animations, data binding, layouts, and custom controls.

Mindmap

mindmap
  root((repo))
    What it does
      Shows WPF feature usage
      Self-contained projects
      Accessibility examples
    Tech Stack
      C#
      WPF
      .NET 10
      Visual Studio
    Use Cases
      Learn WPF APIs
      Copy starter code
      Accessibility reference
    Topics Covered
      Data binding
      Animations
      Layout panels
      Text editing
    Audience
      Windows desktop developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Copy a self-contained sample project as a starting point when learning how a specific WPF API like data binding or animations works.

USE CASE 2

Run individual samples in Visual Studio to see a working example of a WPF feature before adding it to your own app.

USE CASE 3

Use the accessibility-updated samples as a reference when updating an existing WPF app to meet accessibility standards.

Tech stack

C#WPF.NETVisual Studio

Getting it running

Difficulty · easy Time to first run · 30min

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.

License terms are not described in the explanation.

In plain English

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.

Copy-paste prompts

Prompt 1
Show me a complete WPF C# example of two-way data binding between a TextBox and a ViewModel property that updates in real time.
Prompt 2
How do I create a custom WPF control in C# with a dependency property and a default style defined in a resource dictionary?
Prompt 3
Give me a WPF animation example in C# that fades a button from fully visible to invisible when clicked, using a Storyboard.
Prompt 4
How do I build and run a single WPF sample project from the microsoft/wpf-samples repo without loading the entire solution?
Open on GitHub → Explain another repo

← microsoft on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.