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 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.