Pages

Friday, May 11, 2012

What is WPF XAML ?


XAML (short for Extensible Application Markup Language, and pronounced “zammel”) is a markup language used to instantiate .NET objects. In other words, XAML documents define the arrangement of panels, buttons, and controls that make up the windows in a WPF application.

The Variants of XAML

WPF XAML encompasses the elements that describe WPF content, such as vector graphics, controls, and documents. Currently, it’s the most significant application of XAML.

XPS XAML is the part of WPF XAML that defines an XML representation for formatted electronic documents. It’s been published as the separate XML Paper Specification (XPS) standard.

Silverlight XAML is a subset of WPF XAML that’s intended for Silverlight applications. Silverlight is a cross-platform browser plug-in that allows you to create rich web content with two-dimensional graphics, animation, and audio and video. Chapter 1 has more about Silverlight, or you can visit http://silverlight.net to learn about it in detail.

WF XAML encompasses the elements that describe Windows Workflow Foundation (WF) content.

XAML Compilation

WPF addresses this shortcoming with BAML (Binary Application Markup Language). BAML is really nothing more than a binary representation of XAML. When you compile a WPF application in Visual Studio, all your XAML files are converted into BAML and that BAML is then embedded as a resource into the final DLL or EXE assembly. BAML is tokenized, which means lengthier bits of XAML are replaced with shorter tokens. Not only is BAML significantly smaller, it’s also optimized in a way that makes it faster to parse at runtime.

Most developers won’t worry about the conversion of XAML to BAML because the compiler performs it behind the scenes. However, it is possible to use XAML without compiling it first. This might make sense in scenarios that require some of the user interface to be supplied just in time (for example, pulled out of a database as a block of XAML tags).

No comments:

Post a Comment