eXtensible Application Markup Language (XAML)

XAML is a declarative markup language that can be used to define user interfaces. The user interface is defined in an XML file using the XAML syntax, while runtime behavior is defined in a separate code-behind file.

Evolve 2016: Becoming a XAML Master

XAML Controls

All of the views that are defined in Xamarin.Forms can be referenced from XAML files.

XAML Basics

XAML allows developers to define user interfaces in Xamarin.Forms applications using markup rather than code. XAML is never required in a Xamarin.Forms program but it is toolable, and is often more visually coherent and more succinct than equivalent code. XAML is particularly well suited for use with the popular Model-View-ViewModel (MVVM) application architecture: XAML defines the View that is linked to ViewModel code through XAML-based data bindings.

XAML Compilation

XAML can be optionally compiled directly into intermediate language (IL) with the XAML compiler (XAMLC). This article describes how to use XAMLC, and its benefits.

XAML Previewer

The XAML Previewer renders a live preview of a page side-by-side with the XAML markup, allowing you to see your user interface rendered as you type.

XAML Namespaces

XAML uses the xmlns XML attribute for namespace declarations. This article introduces the XAML namespace syntax, and demonstrates how to declare a XAML namespace to access a type.

XAML Custom Namespace Schemas

A XAML custom namespace schema can be defined with the XmlnsDefinitionAttribute class, which specifies a mapping between a custom URL and one or more CLR namespaces. The custom namespace schema can then be used in XAML namespace declarations.

The XmlnsPrefixAttribute class can be used by control authors to specify a recommended prefix to associate with a XAML namespace, for XAML usage.

XAML Markup Extensions

XAML includes markup extensions for setting attributes to values or objects beyond what can be expressed with simple strings. These include referencing constants, static properties and fields, resource dictionaries, and data bindings.

Field Modifiers

The x:FieldModifier namespace attribute specifies the access level for generated fields for named XAML elements.

Passing Arguments

XAML can be used to pass arguments to non-default constructors or to factory methods. This article demonstrates using the XAML attributes that can be used to pass arguments to constructors, to call factory methods, and to specify the type of a generic argument.

Bindable Properties

In Xamarin.Forms, the functionality of common language runtime (CLR) properties is extended by bindable properties. A bindable property is a special type of property, where the property's value is tracked by the Xamarin.Forms property system. This article provides an introduction to bindable properties, and demonstrates how to create and consume them.

Attached Properties

An attached property is a special type of bindable property, defined in one class but attached to other objects, and recognizable in XAML as an attribute that contains a class and a property name separated by a period. This article provides an introduction to attached properties, and demonstrates how to create and consume them.

Resource Dictionaries

XAML resources are definitions of objects that can be used more than once. A ResourceDictionary allows resources to be defined in a single location, and re-used throughout a Xamarin.Forms application. This article demonstrates how to create and consume a ResourceDictionary, and how to merge one ResourceDictionary into another.

Loading XAML at Runtime

XAML can be loaded and parsed at runtime with the LoadFromXaml extension methods.