Chapter 4. XAML

 

This chapter covers

  • XAML elements and namespaces
  • Properties, events, and commands
  • Object trees and namescope

XAML (Extensible Application Markup Language) is a declarative language that enables you to create and initialize objects using XML. This approach to development was popularized by the WPF and Silverlight, as well as by Silverlight on Windows Phone.

Everything you can do in XAML, you can do in code. But to make the most of the platform and its tooling, you’ll want to embrace the code-plus-markup philosophy rather than go with a 100% code solution. The road to this approach has been well trodden by Silverlight, WPF, and Windows Phone, so I’m completely comfortable in saying code plus markup should be the default approach for almost every application you write.

Note

The markup language, the property system, and the things that make those two work together are collectively referred to as WinRT XAML, mostly because it’s easier than saying “C# or VB with .NET and the Windows Runtime using XAML for presentation.” Trust me on that.

4.1. Elements and namespaces

4.2. Properties

4.3. Object trees and namescope

4.4. Summary