UWP Documentation

Getting Started

The Universal Windows Platform (UWP) enables you to create applications that run across all Windows 10 devices — PCs, tablets, phones, Xbox, HoloLens, and IoT.

To begin a new UWP project:

dotnet new winui3 -n MyUwpApp
cd MyUwpApp
dotnet build

Or use Visual Studio's File → New → Project → Blank App (UWP) template.

XAML Basics

XAML defines the UI layout. Below is a simple page with a Button and a TextBlock:

<Page
    x:Class="MyUwpApp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <StackPanel HorizontalAlignment="Center"
                VerticalAlignment="Center">
        <TextBlock x:Name="MessageText"
                   Text="Hello, UWP!" 
                   FontSize="24"/>
        <Button Content="Click Me"
                Click="OnButtonClick"
                Margin="0,20,0,0"/>
    </StackPanel>
</Page>

App Lifecycle

UWP apps have five main states: Running, Suspended, Terminated, NotRunning, and ClosedByUser. Handle lifecycle events in App.xaml.cs:

protected override void OnLaunched(LaunchActivatedEventArgs e)
{
    // Initialize root frame...
}

protected override void OnSuspending(object sender, SuspendingEventArgs e)
{
    // Save app state
}

API Reference

Key namespaces:

  • Windows.UI.Xaml – UI elements and controls
  • Windows.Storage – File and folder access
  • Windows.Devices.Geolocation – Location services
  • Windows.ApplicationModel – App model, activation, and lifecycle

Samples

Explore official samples on GitHub:

Additional Resources