Extensible Application Markup Language (XAML ) is a
declarative XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
-based language that
Microsoft
Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
developed for initializing structured values and objects. It is available under Microsoft's
Open Specification Promise The Microsoft Open Specification Promise (or OSP) is a promise by Microsoft, published in September 2006, to not assert its patents, in certain conditions, against implementations of a certain list of specifications.
The OSP is not a licence, but ...
.
XAML is used extensively in
Windows Presentation Foundation
Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem (similar to WinForms) originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initia ...
(WPF),
Silverlight
Microsoft Silverlight is a discontinued application framework designed for writing and running rich web applications, similar to Adobe Inc., Adobe's Run time environment, runtime, Adobe Flash. A plugin for Silverlight is still available for a v ...
,
Workflow Foundation (WF),
Windows UI Library
Windows UI Library (WinUI codenamed "Jupiter", and also known as UWP XAML and WinRT XAML) is a user interface API that is part of the Windows Runtime programming model that forms the backbone of Universal Windows Platform apps (formerly known as ...
(WinUI) and
Universal Windows Platform
Universal Windows Platform (UWP) is a computing platform created by Microsoft and first introduced in Windows 10. The purpose of this platform is to help develop universal apps that run on Windows 10, Windows 10 Mobile (discontinued), Windows 1 ...
(UWP). In WPF and UWP, XAML is a
user interface markup language
A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually ...
to define UI elements, data binding, and events. In WF, however, XAML defines
workflow
A workflow consists of an orchestrated and repeatable pattern of activity, enabled by the systematic organization of resources into processes that transform materials, provide services, or process information. It can be depicted as a sequence of ...
s.
XAML elements map directly to
Common Language Runtime (CLR) object instances, while XAML attributes map to CLR properties and events on those objects.
Anything that is created or implemented in XAML can be expressed using a more traditional .NET language, such as
C# or
Visual Basic .NET
Visual Basic, originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visua ...
. However, a key aspect of the technology is the reduced complexity needed for tools to process XAML, because it is based on XML.
Technology
XAML originally stood for Extensible Avalon Markup Language, ''Avalon'' being the code-name for
Windows Presentation Foundation
Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem (similar to WinForms) originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initia ...
(WPF).
[Rob Relyea : January 2004 – Posts](_blank)
Before the end .NET Framework 3.0 development, however, Microsoft adopted XAML for
Workflow Foundation (WF).
In WPF, XAML describes visual
user interface
In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
s. WPF allows for the definition of both 2D and 3D objects, rotations, animations, and a variety of other effects and features. A XAML file can be compiled into a
Binary Application Markup Language
The Binary Application Markup Language is a file format developed by Microsoft that is generated by compiling XAML files.
Generation
An XAML file can be compiled into a Binary Application Markup Language file with the .BAML extension, which may ...
(BAML) file,
which may be inserted as a resource into a .NET Framework assembly. At run-time, the framework engine extracts the BAML file from assembly resources, parses it, and creates a corresponding WPF visual tree or workflow.
In WF contexts, XAML describes potentially long-running declarative logic, such as those created by process modeling tools and rules systems. The
serialization format for workflows was previously called XOML, to differentiate it from UI markup use of XAML, but now they are no longer distinguished. However, the file extension for files containing the workflow markup is still ".xoml".
XAML uses a specific way to define
look and feel
In software design, the look and feel of a graphical user interface comprises aspects of its design, including elements such as colors, shapes, layout, and typefaces (the "look"), as well as the behavior of dynamic elements such as buttons, boxe ...
called ''Template''s; differing from
Cascading Style Sheet
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technol ...
syntax, it is closer to
XBL
XBL (''XML Binding Language'') is an XML-based markup language for altering the behavior of XUL widgets. It was devised at Netscape in the late 1990s as an extension of XUL.
The primary use of XBL was in the Firefox web browser, but Mozilla depre ...
.
To create XAML files, one could use
Microsoft Expression Blend
Microsoft Blend for Visual Studio (formerly Microsoft Expression Blend) is a user interface design tool developed and sold by Microsoft for creating graphical interfaces for web and desktop applications that blend the features of these two types ...
,
Microsoft Visual Studio
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such a ...
, the hostable WF visual designer, or XAMLPad.
Example
This Windows Presentation Foundation example shows the text "Hello, world!" in the top-level XAML container called Canvas.
The schema (the part) may have to be changed to work on your computer.
Using a schema that Microsoft recommends, the example can also be
This can be integrated into a
Web page if WPF is installed using
XBAP
XAML Browser Applications (XBAP, pronounced "ex-bap") are Windows Presentation Foundation (.xbap) applications that are hosted and run inside a web browser such as Firefox or Internet Explorer. Hosted applications run in a partial trust sandbox en ...
s (XAML Browser Applications) that are compiled applications running in a sandboxed environment hosted within the browser. Another way is to use the
Silverlight plugin. The code cannot be included directly in an
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
page; rather it must be loaded into the page via
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
. If .NET 3.0 or later is installed, loose XAML files can also be viewed on their own in a compatible
Web browser
A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used on ...
(including
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated IE or MSIE) is a series of graphical user interface, graphical web browsers developed by Microsoft which was used in the Microsoft Wind ...
and
Firefox
Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements current and ...
) in conjunction with the .NET Framework 3.0, without the need for the Silverlight plugin. Loose XAML files are markup-only files limited to defining the visual content to be rendered. They are not compiled with an application.
XAML Example
The ''MySilverlight.js'' file must contain the code that loads the above XAML code (as an XML file) under the ''MySilverlight'' HTML element.
A crucial part of utilizing XAML to its full potential is making appropriate usage of binding, as well as being comfortable with creating your own custom user elements as required, for your specific needs. Binding can be done as follows:
Differences between versions of XAML
There are three main Microsoft implementations of XAML:
*
Windows Presentation Foundation
Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem (similar to WinForms) originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initia ...
(WPF), first available with
.NET Framework 3.0
Microsoft started development on the .NET Framework in the late 1990s originally under the name of Next Generation Windows Services (NGWS). By late 2001 the first beta versions of .NET 1.0 were released. The first version of .NET Framework was ...
*
Silverlight
Microsoft Silverlight is a discontinued application framework designed for writing and running rich web applications, similar to Adobe Inc., Adobe's Run time environment, runtime, Adobe Flash. A plugin for Silverlight is still available for a v ...
3 and 4, first available for
Internet Explorer 6
Microsoft Internet Explorer 6 (IE6) is a graphical web browser developed by Microsoft for Windows operating systems. Released on August 24, 2001, it is the sixth, and by now discontinued, version of Internet Explorer and the successor to Internet ...
and now deprecated
*
Windows UI Library
Windows UI Library (WinUI codenamed "Jupiter", and also known as UWP XAML and WinRT XAML) is a user interface API that is part of the Windows Runtime programming model that forms the backbone of Universal Windows Platform apps (formerly known as ...
(formerly UWP XAML and WinRT XAML), first shipped with
Windows 8
Windows 8 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on August 1, 2012; it was subsequently made available for downl ...
and
Windows Server 2012
Windows Server 2012, codenamed "Windows Server 8", is the sixth version of the Windows Server operating system by Microsoft, as part of the Windows NT family of operating systems. It is the server version of Windows based on Windows 8 and succe ...
, but now available as a part of the
Windows App SDK
Windows App SDK (formerly known as Project Reunion) is a software development kit (SDK) from Microsoft that targets the development of native desktop applications on Windows 11 and Windows 10 back to version 1809.
Windows App SDK does not replac ...
These versions have some differences in the parsing behavior. Additionally, the Silverlight 4 XAML parser is not 100%
backward-compatible
Backward compatibility (sometimes known as backwards compatibility) is a property of an operating system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system, especially in ...
with Silverlight 3 files. Silverlight 3 XAML files may be rejected or parsed differently by the Silverlight 4 parser.
Response from the competition
In 2007,
European Committee for Interoperable Systems (ECIS) – a coalition of mostly American software companies – accused Microsoft of attempting to hijack HTML and replace it with XAML, thus creating a vendor lock-in.
Jeremy Reimer, writing for ''
Ars Technica
''Ars Technica'' is a website covering news and opinions in technology, science, politics, and society, created by Ken Fisher and Jon Stokes in 1998. It publishes news, reviews, and guides on issues such as computer hardware and software, sci ...
'' described this comment as "the most egregious error" and added that XAML is unlikely to ever replace HTML.
See also
*
List of user interface markup languages
The following is a list of user interface markup languages.
By vendor or platform Flash
*MXML
* OpenLaszlo
Java
* Thinletbr>* ZK Framework, ZUML Ajax web application UI generator
* FXML/JavaFX
See alsOpen Source XML UI Toolkits in Java Microsoft ...
*
Comparison of user interface markup languages The following tables compare general and technical information for some user interface markup languages. Please see the individual markup languages' articles for further information.
General information
Basic general information about the markup la ...
:
*
EMML
EMML, or Enterprise Mashup Markup Language, is an XML markup language for creating enterprise mashups, which are software applications that consume and mash data from variety of sources, often performing logical or mathematical operations as well ...
*
FXML
FXML is an XML-based user interface markup language created by Oracle Corporation for defining the user interface of a JavaFX
JavaFX is a software platform for creating and delivering desktop applications, as well as rich web applications t ...
*
MXML
MXML is an XML-based user interface markup language first introduced by Macromedia in March 2004. Application developers use MXML in combination with ActionScript to develop rich web applications, with products such as Apache Flex.
Adobe ...
*
XPS
*
XUL
XUL ( ), which stands for XML User Interface Language, is a user interface markup language developed by Mozilla. XUL is an XML dialect for writing graphical user interfaces, enabling developers to write user interface elements in a manner sim ...
*
ZUML
*
Interface Builder
Interface Builder is a software development application for Apple's macOS operating system. It is part of Xcode (formerly Project Builder), the Apple Developer developer's toolset. Interface Builder allows Cocoa and Carbon developers to creat ...
*
Layout manager Layout managers are software components used in widget toolkits which have the ability to lay out graphical control elements by their relative positions without using distance units. It is often more natural to define component layouts in this mann ...
References
External links
XAML Language ReferenceXAML for UWP: OverviewXAML for WPF: OverviewSystem.Windows.Markup NamespaceSystem.Xaml Namespace
{{Document markup languages
.NET terminology
Declarative markup languages
Declarative programming languages
Markup languages
Microsoft application programming interfaces
Microsoft Windows multimedia technology
User interface markup languages
Vector graphics markup languages
XML-based standards