100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
.NET

XAML in WPF vs UWP vs MAUI

A comparison of how XAML is used across WPF, UWP, and .NET MAUI, covering namespace differences, binding models, and platform reach.

XAML Across PlatformsIntermediate9 min readJul 10, 2026
Analogies

Three XAML Dialects, One Language Core

XAML began as the markup language for Windows Presentation Foundation (WPF) in 2006, and it has since been adapted for the Universal Windows Platform (UWP) and, most recently, .NET MAUI. All three share the same declarative element-attribute syntax, the same idea of mapping XML elements to CLR objects, and the same core concepts of dependency properties, data binding, and resource dictionaries. What differs between them is the underlying rendering engine, the namespace URIs you import, the binding engine (classic Binding versus compiled x:Bind), and the set of controls each platform ships with natively.

🏏

Cricket analogy: Think of XAML as the LBW law applied consistently across Test, ODI, and T20 formats: the same core rule governs every version, but umpiring nuances like DRS availability change per format, just as binding engines differ per XAML platform.

WPF XAML — Desktop-First Foundations

WPF XAML targets Windows desktop applications running on .NET (or the older .NET Framework) and uses the namespace http://schemas.microsoft.com/winfx/2006/xaml/presentation. It exposes the richest control set of the three, full styling and templating via ControlTemplate and DataTemplate, routed events that bubble and tunnel through the visual tree, and a mature Binding markup extension that supports RelativeSource, ElementName, and value converters. Because WPF has no sandbox restrictions, it can access the full Win32 API surface, making it the go-to choice for line-of-business desktop tools, CAD-adjacent software, and trading terminals that need dense, custom-drawn UI.

🏏

Cricket analogy: WPF is like a full-strength Test match squad with every specialist available — an opener, a spinner, an all-rounder, and a wicketkeeper-batsman — mirroring WPF's deep bench of controls and templating options unconstrained by any format limit.

UWP XAML — Sandboxed and Adaptive

UWP XAML uses the namespace http://schemas.microsoft.com/winfx/2006/xaml/presentation as well, but the runtime underneath is WinRT, not the full CLR-plus-Win32 stack, and every app runs inside an AppContainer sandbox with capability-based permissions declared in Package.appxmanifest. UWP introduced x:Bind, a compiled binding syntax that resolves at build time instead of runtime, giving significantly better performance and compile-time error checking than classic Binding. It also pioneered AdaptiveTrigger and VisualState for responsive layouts that reflow automatically across phone, tablet, Xbox, and HoloLens form factors — a capability later carried forward into MAUI's own adaptive layout story.

🏏

Cricket analogy: UWP's sandbox is like a net practice session where a batsman can only face specific pre-approved deliveries requested from the bowling machine, just as an AppContainer only grants capabilities explicitly declared in the manifest.

.NET MAUI XAML — Cross-Platform Unification

.NET MAUI XAML uses http://schemas.microsoft.com/dotnet/2021/maui as its default namespace and compiles the same markup down to native controls on Windows, macOS (via Mac Catalyst), iOS, and Android through a handler-based architecture that replaced Xamarin.Forms's renderer model. A single .xaml file for a ContentPage produces a UIViewController on iOS, an Activity-hosted view on Android, and a Page on Windows, all from one shared project rather than the platform-specific head projects UWP and WPF required. MAUI also inherited and refined x:Bind-style compiled bindings alongside classic Binding, and its Shell navigation model gives cross-platform apps a common flyout and tab navigation structure that neither WPF nor UWP natively provided.

🏏

Cricket analogy: MAUI is like a single set of playing regulations the ICC applies across all full-member nations' home grounds, with local groundstaff adapting the pitch, just as one MAUI XAML file adapts to native controls per platform via handlers.

xml
<!-- WPF: Window root, PresentationFramework namespace -->
<Window x:Class="WpfApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="WPF App" Height="350" Width="525">
    <Button Content="Click me" Click="Button_Click" />
</Window>

<!-- UWP: Page root, x:Bind compiled binding -->
<Page x:Class="UwpApp.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Button Content="{x:Bind ViewModel.Label}" Click="{x:Bind ViewModel.OnClick}" />
</Page>

<!-- .NET MAUI: ContentPage root, dotnet/maui namespace -->
<ContentPage x:Class="MauiApp.MainPage"
             xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Button Text="Click me" Clicked="OnButtonClicked" />
</ContentPage>

All three platforms share the xmlns:x namespace for x:Class, x:Name, and x:Key — only the default presentation namespace and the root element type change. Recognizing the root element (Window, Page, ContentPage) is often the fastest way to identify which XAML dialect you're reading.

Do not assume a control name means the same thing across platforms — WPF's Grid and MAUI's Grid share a name and row/column concept but differ in default sizing behavior and available attached properties. Always check the platform-specific documentation before porting XAML between WPF, UWP, and MAUI.

  • WPF, UWP, and MAUI all use XAML's declarative element-to-CLR-object mapping, but with different root namespaces and root elements.
  • WPF targets Windows desktop with unrestricted Win32 access and the richest, most mature control and templating library.
  • UWP runs inside a sandboxed AppContainer with capability-based permissions declared in the app manifest.
  • UWP introduced compiled x:Bind bindings and AdaptiveTrigger/VisualState for responsive, form-factor-aware layouts.
  • .NET MAUI compiles a single shared XAML tree into native controls on Windows, macOS, iOS, and Android via a handler architecture.
  • MAUI's Shell provides unified flyout and tab navigation that neither WPF nor UWP offered natively.
  • Porting XAML between platforms requires checking control-level behavior differences even when element names match.

Practice what you learned

Was this page helpful?

Topics covered

#NET#XAMLStudyNotes#MicrosoftTechnologies#XAMLInWPFVsUWPVsMAUI#XAML#WPF#UWP#MAUI#StudyNotes#SkillVeris