WPF Documentation

Windows Presentation Foundation (WPF)

Windows Presentation Foundation (WPF) is a UI framework for building Windows desktop applications with .NET. It combines a powerful markup language (XAML) with a rich set of graphics, animation, and data-binding capabilities.

Key Features

Simple Hello World

Below is a minimal WPF application that shows a window with a button. Click the button to display a message.

<Window x:Class="HelloWorld.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Hello World" Height="200" Width="300">
    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
        <Button Content="Click Me" Width="100" Click="OnClick"/>
    </StackPanel>
</Window>

using System.Windows;

namespace HelloWorld
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void OnClick(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Hello, WPF!");
        }
    }
}

Next Steps