The XAML Syntax

The XAML language is a complex and very flexible markup language applied to different technologies by using different references in the XAML file so that you can refer to different objects that provide different XAML elements and attributes.

Like any other XML file, a XAML file must have a valid structure and must follow some specific rules; one of these rules is the presence of a valid root element.

Namespaces and Root Elements

In XAML you define a root element as the root of your XAML document; this is a mandatory requirement for the XAML file and for the XML validation. In a WPF context, the root element of a XAML file will be a Page, UserControl, or Window if you are creating a UI container or a simple ResourceDictionary

Get Applied WPF 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.