WinUI 3

WinUI 3 is the native UI framework for new Windows desktop apps in the Windows App SDK stack.

Minimal Mental Model

<Window
    x:Class="MyApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid Padding="24">
        <Button Content="Click me" />
    </Grid>
</Window>

The markup looks familiar if you know XAML, but the runtime is desktop WinUI 3, not UWP XAML.

Use These Namespaces

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Windowing;

Do not use these for WinUI 3 app code:

using Windows.UI.Xaml;
using Windows.UI.Popups;
using Windows.UI.ViewManagement;

WinUI 3 Versus UWP WinUI 2

TopicWinUI 3UWP/WinUI 2
App modelDesktop app through Windows App SDKUWP app model
NamespaceMicrosoft.UI.XamlWindows.UI.Xaml
WindowingWindow, HWND, AppWindowCoreWindow, ApplicationView
DispatcherDispatcherQueueCoreDispatcher
DialogsContentDialog with XamlRootUWP dialog patterns
LifecycleDesktop-likeSuspend/resume UWP lifecycle

ContentDialog Pattern

var dialog = new ContentDialog
{
    Title = "Delete item?",
    Content = "This cannot be undone.",
    PrimaryButtonText = "Delete",
    CloseButtonText = "Cancel",
    XamlRoot = this.Content.XamlRoot,
};

await dialog.ShowAsync();

Gotcha: A ContentDialog without XamlRoot is a classic AI-generated WinUI 3 bug.