Template:Short description Template:Infobox file format

Extensible Application Markup Language (XAML Template:IPAc-en) is a declarative XML-based language developed by Microsoft for initializing structured values and objects. It is available under Microsoft's Open Specification Promise.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

XAML is used extensively in Windows Presentation Foundation (WPF), Silverlight, Workflow Foundation (WF), Windows UI Library (WinUI), Universal Windows Platform (UWP), and .NET Multi-platform App UI (.NET MAUI). In WPF and UWP, XAML is a user interface markup language to define UI elements, data binding, and events. In WF, however, XAML defines workflows.

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. However, a key aspect of the technology is the reduced complexity needed for tools to process XAML, because it is based on XML.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

TechnologyEdit

XAML originally stood for Extensible Avalon Markup Language, Avalon being the code-name for Windows Presentation Foundation (WPF).<ref name=":1">Template:Usurped</ref> Before the end of .NET Framework 3.0 development, however, Microsoft adopted XAML for Workflow Foundation (WF).<ref name=":1" />

In WPF, XAML describes visual user interfaces. 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 (BAML) file,<ref name=":1" /><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> 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".<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

XAML uses a specific way to define look and feel called Templates; differing from Cascading Style Sheet syntax, it is closer to XBL.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

To create XAML files, one could use Microsoft Expression Blend, Microsoft Visual Studio, the hostable WF visual designer, or XAMLPad.<ref name="Avery">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

ExamplesEdit

This Windows Presentation Foundation example shows the text "Hello, world!" in the top-level XAML container called Canvas.

<syntaxhighlight lang="XML"> <Canvas xmlns="http://schemas.microsoft.com/client/2010"

       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 <TextBlock>Hello, world!</TextBlock>

</Canvas> </syntaxhighlight>

The schema (the <syntaxhighlight lang="text" class="" style="" inline="1">xmlns="http://schemas.microsoft.com/..."</syntaxhighlight> part) may have to be changed to work on your computer. Using a schema that Microsoft recommends, the example can also be<ref>Microsoft XAML Overview page at XAML Overview (Root element and xmlns)</ref>

<syntaxhighlight lang="XML"> <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

 <TextBlock>Hello, world!</TextBlock>

</Canvas> </syntaxhighlight>

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:<syntaxhighlight lang="xml"> <TextBox x:Name="txtInput" /> <TextBlock Text="{Binding ElementName=txtInput,Path=Text}" /> </syntaxhighlight>

Differences between versions of XAMLEdit

There are three main Microsoft implementations of XAML:

These versions have some differences in the parsing behavior.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Additionally, the Silverlight 4 XAML parser is not 100% backward-compatible with Silverlight 3 files. Silverlight 3 XAML files may be rejected or parsed differently by the Silverlight 4 parser.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

XAML applications in web browsersEdit

Historically, XAML based applications could be run in some web browsers, such as Internet Explorer and Firefox. This could be achieved through XBAP files created from WPF applications, or via the Silverlight browser plugin. However, both these methods are now unsupported on all major browsers due to their reliance on the discontinued NPAPI browser plugin interface.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Lock-in concernsEdit

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.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref name=":0">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Jeremy Reimer, writing for Ars Technica described this comment as "the most egregious error" and added that XAML is unlikely to ever replace HTML.<ref name=":0" />

See alsoEdit

Template:Div col

Template:Div col end

ReferencesEdit

Template:Reflist

External linksEdit

Template:Sister project

Template:.NET Framework Template:Widget toolkits Template:Graphics file formats Template:Document markup languages