THE EXTENSIBLE APPLICATION MARKUP LANGUAGE (XAML)

XAML is a language that is defined in the eXtensible Markup Language (XML). XML is a meta-language that is used for defining a wide range of application-specific languages. XAML looks a bit like HTML in that it consists of tags and attributes with embedded text, but don’t be fooled — XAML is quite different, with rigid rules for correctly writing XAML and none of the flexibility you have when writing HTML. You use XAML to define a set of elements in a hierarchy that specify the UI for a Windows 8 app. The UI for an application consists of one or more pages, and each page is defined by a separate XAML file with the extension .xaml.

The XAML definition for a page includes the controls and their layout. It also associates C++ functions with events that originate from user interaction with the controls in the UI. The XAML definition of a UI component will have an associated C++ class that encapsulates the component and its characteristics. A UI page defined by a .xaml file will have an associated .h file that contains the definition of a C++ class that encapsulates the page. It will also have an associated.cpp file that contains the class implementation.

XAML Elements

A XAML file always contains XAML elements that are arranged in a hierarchy. A XAML element has a type name that is case sensitive. You can define a XAML element by a start tag, for example <Grid>, followed by some optional element content, followed by an end tag, for example ...

Get Ivor Horton's Beginning Visual C++ 2012 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.