Logical Resources

The second type of resources is a mechanism first introduced by WPF and supported by all XAML-based frameworks. In this chapter, these resources are called logical resources for lack of a better term, but mostly the book refers to them as resources in contrast to the binary resources just covered. (You might be tempted to call them XAML resources, but as with almost everything else in XAML, you can create and use them entirely in procedural code.)

These logical resources are arbitrary objects stored (and named) in an element’s Resources property, typically meant to be shared by multiple child elements. The FrameworkElement base class has a Resources property, so most classes you’ll encounter in XAML have such a property. These ...

Get XAML Unleashed 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.