Home > Articles > Web Development

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

XAML Keywords

The XAML language namespace (http://schemas.microsoft.com/winfx/2006/xaml) defines a handful of keywords that must be treated specially by any XAML compiler or parser. Table 2.1 lists them all, along with the chapter that discusses each one further. Several of them require a specific context in order to be usable. For example, several are only valid for WPF.

TABLE 2.1 Keywords in the XAML Language Namespace, Assuming the Conventional x Namespace Prefix

Keyword

Valid As

Chapter

Meaning

x:Array

An element

4

Represents an array. An x:Array element’s children are the elements of the array. It must be used with x:Type to define the type of the array.

x:AsyncRecords

Attribute on root element

3

Controls the size of asynchronous XAML-loading chunks.

x:Arguments

Attribute on or element inside any element

4

Specifies an argument (or multiple arguments in the element syntax) to be passed to the element’s constructor. When used with x:FactoryMethod, specifies argument(s) for the factory method.

x:Boolean

An element

4

Represents a System.Boolean.

x:Byte

A XAML2009 element

4

Represents a System.Byte.

x:Char

A XAML2009 element

4

Represents a System.Char.

x:Class

Attribute on root element

3

Defines a class for the root element that derives from the element type, optionally prefixed with a namespace.

x:ClassAttributes

Attribute on root element and must be used with x:Class

N/A

Contains attributes relevant for Windows Workflow Foundation activities.

x:ClassModifier

Attribute on root element and must be used with x:Class

3

Defines the visibility of the class specified by x:Class (which is public by default). The attribute value must be specified in terms of the procedural language being used (for example, public or internal for C#).

x:Code

Element anywhere in XAML but must be used with x:Class

3

Embeds procedural code to be inserted into the class specified by x:Class.

x:ConnectionId

Attribute

N/A

Not for public use.

x:Decimal

A XAML2009 element

4

Represents a System.Decimal.

x:Double

An element

4

Represents a System.Double.

x:FactoryMethod

Attribute on any element

4

Specifies a static method to be called to retrieve the element instance instead of its constructor.

x:FieldModifier

Attribute on any nonroot element but must be used with x:Name (or equivalent)

3

Defines the visibility of the field to be generated for the element (which is internal by default). As with x:ClassModifier, the value must be specified in terms of the procedural language (for example, public, private, … for C#).

x:Int16

A XAML2009 element

4

Represents a System.Int16.

x:Int32

An element

4

Represents a System.Int32.

x:Int64

A XAML2009 element

4

Represents a System.Int64.

x:Key

Attribute on an element whose parent implements IDictionary

2

Specifies the key for the item when added to the parent dictionary.

x:Members

Inside an Activity class

4

Defines additional members for the root class specified by x:Class.

x:Name

Attribute on any nonroot element but must be used with x:Class

3

Chooses a name for the field to be generated for the element, so it can be referenced from procedural code.

x:Null

A property element or attribute value

4

Represents a null reference.

x:Object

A XAML2009 element

4

Represents a System.Object.

x:Property

Inside an x:Members element

4

Defines a new property.

x:Reference

A property element or attribute value

17

A reference to a named element.

x:Shared

Attribute on any element in a ResourceDictionary, but only works if XAML is compiled

16

A WPF-specific concept that doesn’t really belong in the XAML language namespace.

x:Single

A XAML2009 element

4

Represents a System.Single.

x:Static

A property element or attribute value

4

References any static property, field, constant, or enumeration value.

x:String

An element

4

Represents a System.String

x:Subclass

Attribute on root element and must be used with x:Class

3

Specifies a subclass of the x:Class class that holds the content defined in XAML, optionally prefixed with a namespace (used with languages without support for partial classes).

x:SynchronousMode

Attribute on root element

3

Specifies whether the XAML content is allowed to be loaded asynchronously.

x:TimeSpan

A XAML2009 element

4

Represents a System.TimeSpan.

x:Type

A property element or attribute

4

Represents a System.Type, just like the typeof operator in C#.

x:TypeArguments

Attribute on any element in XAML2009, or attribute on root element that must be used with x:Class in XAML2006

4

Makes the class generic (for example, List<T>) with the specified generic argument instantiations (for example, List<Int32> or List<String>). Can be set to a comma-delimited list of generic arguments, with XML namespace prefixes for any types not in the default namespace.

x:Uid

Attribute on any element

16

Marks an element with an identifier used for localization.

x:Uri

A XAML2009 element

4

Represents a System.Uri.

x:XData

Element used as the value for any property of type IXmlSerializable

17

An arbitrary XML data island that remains opaque to the XAML parser.

  • + Share This
  • 🔖 Save To Your Account