XAML Basics

The XAML standard is quite straightforward once you understand a few ground rules:

  • Every element in a XAML document maps to an instance of a .NET class. The name of the element matches the name of the class exactly. For example, the element <Button> instructs WPF to create a Button object.

  • As with any XML document, you can nest one element inside another. As you'll see, XAML gives every class the flexibility to decide how it handles this situation. However, nesting is usually a way to express containment—in other words, if you find a Button element inside a Grid element, your user interface probably includes a Grid that contains a Button inside.

  • You can set the properties of each class through attributes. However, in some situations ...

Get Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.