Est. 2006 Intermediate

XAML

Microsoft's XML-based declarative markup language for building user interfaces - born as part of the Longhorn project, released with WPF in 2006, and still defining UIs today across WinUI, .NET MAUI, and Avalonia.

Created by Microsoft

Paradigm Declarative, XML-based markup
Typing Markup maps to strongly typed CLR/WinRT objects
First Appeared 2006
Latest Version XAML object mapping specification [MS-XAML] v2019 (March 2019); dialects continuously updated with WinUI, .NET MAUI, and Avalonia

XAML - the Extensible Application Markup Language - is Microsoft’s XML-based declarative language for describing user interfaces and object graphs. Rather than constructing windows, buttons, and layouts in imperative code, a XAML developer declares them: each XML element maps directly to a .NET or Windows Runtime object, each attribute to a property or event. A <Button> tag in a .xaml file is a Button object, instantiated by a parser instead of a constructor call in C#.

That simple idea - markup as object instantiation - has proven remarkably durable. First released in November 2006 with Windows Presentation Foundation, XAML went on to power Silverlight in the browser, Windows 8 and UWP apps, Xamarin.Forms on mobile, and today’s WinUI 3, .NET MAUI, and the open-source Avalonia framework. Two decades on, XAML remains the default answer to “how do you build a UI in the Microsoft ecosystem?”

History & Origins

Longhorn and Avalon (2003)

XAML emerged from one of the most ambitious projects in Microsoft’s history: Longhorn, the Windows release that eventually became Windows Vista. At the Professional Developers Conference in Los Angeles in October 2003, Microsoft unveiled Longhorn’s pillars, including Avalon - a new vector-based graphics and presentation engine designed to replace the aging GDI-based Windows UI stack. Avalon interfaces would be described in a new XML-based markup language, and the name made the lineage explicit: XAML originally stood for Extensible Avalon Markup Language.

PDC attendees took home a Longhorn preview build whose SDK already included an early XAML compiler. As Avalon matured into a shippable product, it was renamed Windows Presentation Foundation (WPF), and the acronym was retrofitted to Extensible Application Markup Language - a fitting change, since before .NET Framework 3.0 shipped, Microsoft had also adopted XAML as the serialization format for Windows Workflow Foundation, where it describes workflows rather than user interfaces.

Release with .NET Framework 3.0 (2006)

XAML officially arrived in November 2006 as part of .NET Framework 3.0, released alongside Windows Vista. WPF gave Windows developers resolution-independent vector graphics, hardware-accelerated rendering, animation, styling, templating, and rich data binding - and XAML was the language that tied it all together. Microsoft’s tooling strategy leaned into the split between markup and code: developers worked in Visual Studio, while designers could style the same XAML files in Expression Blend.

Beyond the Desktop

XAML quickly escaped its desktop origins:

  • Silverlight (September 2007), developed under the codename WPF/E (“WPF Everywhere”), brought a XAML-based presentation framework to web browsers as a plugin, competing with Adobe Flash.
  • Windows Phone used Silverlight’s XAML dialect for app development.
  • Windows 8 (2012) introduced a native XAML framework for Windows Runtime apps - implemented in C++ rather than managed code, usable from C#, Visual Basic, and C++.
  • Xamarin.Forms (May 2014) extended XAML to cross-platform mobile development for iOS and Android.

In 2008 Microsoft published the [MS-XAML] XAML Object Mapping Specification, placing the core language under the Microsoft Open Specification Promise. The specification was last revised as v2019 in March 2019.

Design Philosophy

Markup as Object Graph

XAML’s core principle is a direct, mechanical mapping between markup and objects. Elements are types, attributes are properties or events, and nesting expresses containment:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Hello XAML" Width="400" Height="200">
    <StackPanel VerticalAlignment="Center">
        <TextBlock Text="Hello, World!"
                   FontSize="24"
                   HorizontalAlignment="Center" />
        <Button Content="Click Me"
                Click="OnButtonClick"
                Margin="0,16,0,0"
                HorizontalAlignment="Center" />
    </StackPanel>
</Window>

Everything above could be written in equivalent C# - XAML adds no runtime capability that code lacks. What it adds is shape: a UI tree reads naturally as nested markup, tooling can render it live, and designers and developers can work on the same artifact.

Separation of Presentation and Logic

XAML pairs each markup file with a “code-behind” class, but its data binding system encourages going further. The Model-View-ViewModel (MVVM) pattern - articulated in 2005 by John Gossman, an architect on the WPF team - uses XAML bindings to connect the view to a testable, UI-agnostic view model, and became the dominant architecture across the XAML ecosystem.

Declarative, Not Turing-Complete

XAML is deliberately not a general-purpose programming language. It has no loops, conditionals, or arithmetic of its own; logic lives in the languages it partners with (C#, F#, Visual Basic, C++). This restraint is a feature: because a XAML document is just a serialized object graph, tools can load, analyze, edit, and re-save it without executing arbitrary code.

Key Features

Markup Extensions

Curly-brace markup extensions let attributes express more than literal strings - references to shared resources, and most importantly, data bindings:

1
2
<TextBlock Text="{Binding CustomerName}" 
           Foreground="{StaticResource AccentBrush}" />

{Binding} connects a UI property to a data source property, with change notification keeping the two synchronized - the machinery that makes MVVM practical.

Styles, Templates, and Resources

XAML separates a control’s behavior from its appearance. Styles apply property sets across many controls; control templates can completely replace a control’s visual tree; data templates declare how bound data objects should be rendered. Resource dictionaries make all of these shareable and theme-able.

Compilation to BAML

In WPF, XAML files are not shipped as raw XML: the build process compiles them into BAML (Binary Application Markup Language), a pre-tokenized binary form embedded in the assembly that is faster to load and parse at runtime.

Attached Properties and Dependency Properties

XAML dialects rely on dependency properties (which support binding, animation, and styling) and attached properties, which let a container attach data to its children - Grid.Row="2" on a button, for example, stores layout information owned by the grid, not the button.

The XAML Family

“XAML” today names a family of closely related dialects rather than a single implementation:

FrameworkYearsWhere it runs
WPF2006-presentWindows desktop (.NET Framework, modern .NET)
Windows Workflow Foundation2006-presentWorkflow definitions (not UI)
Silverlight2007-2021Browser plugin (support ended October 2021)
WinRT / UWP XAML2012-presentWindows 8/10/11 apps
Xamarin.Forms2014-2024iOS, Android, Windows
WinUI 32021-presentWindows desktop via Windows App SDK
.NET MAUI2022-presentiOS, Android, Windows, macOS
Avalonia (third party, open source)2016-presentWindows, macOS, Linux, and more

The dialects share syntax and core concepts but differ in namespaces, available controls, and details of the binding system - enough that Microsoft proposed a unifying “XAML Standard” at Build 2017, an effort that was ultimately shelved in favor of letting each framework evolve independently.

Evolution

XAML’s language layer has been notably stable. The largest revision, informally called XAML 2009, arrived with .NET Framework 4 in 2010 alongside the System.Xaml assembly, which lifted XAML parsing and object-graph services out of WPF into the framework proper - enabling any library to define and consume its own XAML vocabularies.

The bigger story is the evolution of the frameworks around it. Silverlight rose and fell with the browser-plugin era (support ended in October 2021). The Windows 8 WinRT push made XAML native code. Open-sourcing WPF, Windows Forms, and WinUI in December 2018, followed by WPF support in .NET Core 3.0 (September 2019), moved desktop XAML onto the modern .NET platform. WinUI 3 (Windows App SDK 1.0, November 2021) decoupled the Windows XAML stack from the OS release cycle, and .NET MAUI (May 2022) consolidated the Xamarin.Forms lineage. Meanwhile the community-driven Avalonia project - begun as “Perspex” and renamed in 2016 - and Uno Platform carry XAML-style development to macOS, Linux, and the web.

Current Relevance

XAML is not a niche survivor; it is the working present of Windows and .NET UI development. WPF remains one of the most widely deployed desktop frameworks in enterprise software, WinUI 3 is Microsoft’s current native UI platform for Windows apps, and .NET MAUI is its first-party cross-platform mobile answer. Avalonia has built a substantial open-source ecosystem of its own, powering cross-platform applications such as Wasabi Wallet.

The competitive landscape has shifted around it - Electron, Flutter, React Native, and the web absorb much cross-platform work, and even Microsoft ships many apps as web hybrids - but for data-dense native Windows software, the XAML stack remains the default choice, with active development across Microsoft’s repositories and a deep pool of third-party control vendors (Telerik, DevExpress, Syncfusion, and others).

Why It Matters

XAML mainstreamed the idea that a user interface is best expressed as a declarative document rather than a procedure:

  • Declarative UI at scale. XAML demonstrated to a generation of business-software developers that markup plus data binding beats hand-wired imperative UI code - years before declarative UI became fashionable again in React, SwiftUI, and Jetpack Compose (which favor code-based declarations over markup).
  • MVVM. The pattern that grew out of XAML’s binding system became one of the most influential UI architectures of the 2000s and 2010s, well beyond Microsoft platforms.
  • Designer-developer separation. The XAML toolchain was an early, serious attempt to let designers and developers collaborate on the same living artifact instead of throwing mockups over a wall.
  • Direct influence. Qt’s QML, among others, lists XAML as an influence, and third-party ecosystems like Avalonia and Uno Platform chose XAML precisely because its concepts and developer base endure.

From a codename-laden preview at PDC 2003 to the markup behind Visual Studio, Windows Terminal, and modern Windows itself, XAML has quietly described more running user interfaces than almost any other UI language of its era - a markup dialect that outlived the operating system project it was named for.

Timeline

2003
XAML publicly previewed in October at Microsoft's Professional Developers Conference in Los Angeles as the markup language of 'Avalon', the graphics subsystem of the Windows 'Longhorn' project; attendees receive a Longhorn preview build with an early XAML compiler
2006
XAML officially released in November with .NET Framework 3.0, serving as the UI markup language of Windows Presentation Foundation (WPF) and the workflow definition format of Windows Workflow Foundation; ships alongside Windows Vista
2007
Silverlight 1.0 released on September 5, bringing a XAML-based presentation framework to web browsers as a plugin (developed under the codename WPF/E - 'WPF/Everywhere')
2008
Microsoft publishes the [MS-XAML] XAML Object Mapping Specification, documenting the language under the Microsoft Open Specification Promise
2010
.NET Framework 4 ships with the System.Xaml assembly and 'XAML 2009' language enhancements, making XAML services a first-class part of the framework rather than a WPF-internal component
2012
Windows 8 launches with a new native XAML UI framework for Windows Runtime (WinRT) apps, usable from C#, Visual Basic, and C++
2014
Xamarin.Forms launches in May, extending XAML to cross-platform mobile development on iOS and Android
2015
Windows 10 introduces the Universal Windows Platform (UWP), with XAML as the markup language for apps running across PCs, tablets, Xbox, and other Windows devices
2016
The open-source, cross-platform XAML framework Perspex is renamed Avalonia in May, going on to bring XAML-style UI development to Windows, macOS, and Linux
2018
Microsoft open-sources WPF, Windows Forms, and the WinUI XAML library on December 4 at the Connect(); 2018 conference
2019
Version v2019 of the [MS-XAML] specification is published in March; .NET Core 3.0 ships on September 23 with WPF support, carrying XAML forward onto the modern .NET platform
2021
Windows App SDK 1.0 ships in November with WinUI 3, decoupling the Windows XAML UI framework from the operating system
2022
.NET Multi-platform App UI (.NET MAUI), the XAML-based successor to Xamarin.Forms, reaches general availability on May 23, just ahead of Microsoft Build 2022

Notable Uses & Legacy

Visual Studio

Microsoft's flagship IDE has used WPF - and therefore XAML - for its shell and editor UI since Visual Studio 2010, making it one of the largest XAML applications in existence.

Windows Terminal

Microsoft's open-source terminal application renders its tabs, panes, and settings UI with Windows XAML hosted via XAML Islands.

Windows 11 shell experiences

Modern surfaces of Windows 11, including WinUI-based elements of File Explorer and other in-box apps, are built with the WinUI XAML framework.

Wasabi Wallet

The open-source, privacy-focused Bitcoin wallet builds its cross-platform desktop UI with Avalonia, an open-source XAML framework running on Windows, macOS, and Linux.

Enterprise line-of-business applications

Trading desks, healthcare systems, engineering tools, and countless internal corporate desktop applications use WPF and XAML for data-dense, MVVM-architected Windows front ends.

Cross-platform mobile apps with .NET MAUI

.NET shops use MAUI's XAML dialect to define UIs once and deploy native apps to iOS, Android, Windows, and macOS from a single C# codebase.

Language Influence

Influenced By

XML

Influenced

QML

Running Today

Run examples using the official Docker image:

docker pull
Last updated: