Chapter 2. Introducing XAML: A Declarative Way to Create Windows UIs

Before the appearance of .NET 3.0, web applications were written with "markup languages" such as HTML and Windows applications were not. We may have dragged controls onto forms, but the creation of the controls and their properties was managed by the development environment, or you instantiated them programmatically at runtime.

.NET 3.0 changed all that with the introduction of the eXtensible Application Markup Language, or XAML (pronounced "zamel," to rhyme with "camel"). There are two key things to know about XAML:

  1. It is a markup language for creating Windows applications, just as HTML is a markup language for creating web applications.

  2. Almost every XAML object has a corresponding Common Language Runtime (CLR) object; most of what you can create declaratively in XAML you can also create programmatically in C#, and vice versa.

The goal of this chapter is to provide an overview of XAML and how it is used in creating user experiences. By the end of this chapter you should have an appreciation of XAML as a declarative language, an understanding of the basic elements and attributes that you are likely to encounter when writing a .NET 3.5 application, and a fundamental appreciation for hand-crafting meaningful XAML applications. We will not cover every element in the XAML vocabulary, but we will cover the entire landscape of XAML, demonstrating all of its significant capabilities.

Tip

For a detailed treatment of the XAML ...

Get Programming .NET 3.5 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.