Chapter 1. Foundations

In this chapter we will cover the following:

  • Creating custom type instances in XAML
  • Creating a dependency property
  • Using an attached property
  • Creating an attached property
  • Accessing a static property in XAML
  • Creating a custom markup extension
  • Handling routed events


Any attempt at mastering a technology, any technology, requires a good understanding of its foundations. This understanding makes it possible to grasp the more complex aspects of that technology; Windows Presentation Foundation (WPF) is no different.

In this first chapter, we'll discuss recipes concerning the very foundations of WPF – what makes it tick—and also along the way, what makes it unique.


The first noticeable facet of WPF is XAML (eXtensible Markup ...

Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.

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