WinUI API Documentation

What is WinUI?

WinUI (Windows UI Library) is the native user‑interface layer of Windows 10 and later. It provides a modern, fluent design system, a powerful set of controls, and full integration with the Windows ecosystem.

WinUI helps you build responsive, high‑performance apps for desktop, tablets, and Xbox using XAML and C# (or C++/WinRT).

Key Features

Quick Start

Create a new WinUI 3 project in Visual Studio:

dotnet new winui3 -o MyWinUIApp
cd MyWinUIApp
dotnet build
dotnet run

Or use the Visual Studio wizard: File → New → Project → WinUI → Blank App (WinUI 3).

Sample: Simple Counter

This example shows a button that increments a number.

<Window
    x:Class="SampleApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SampleApp"
    Title="Counter">

    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
        <TextBlock x:Name="CountText"
                   FontSize="24"
                   Text="0"
                   HorizontalAlignment="Center"/>
        <Button Content="Increase"
                Click="OnIncrease"
                Margin="0,20,0,0"/>
    </StackPanel>
</Window>

/// <summary>
/// Code‑behind for MainWindow.xaml
/// </summary>
public sealed partial class MainWindow : Window
{
    private int _count = 0;

    public MainWindow()
    {
        this.InitializeComponent();
    }

    private void OnIncrease(object sender, RoutedEventArgs e)
    {
        _count++;
        CountText.Text = _count.ToString();
    }
}

Further Reading