Introduction
Traditional application resources consist of binary chunks of data, typically representing things such as icons, bitmaps, strings, and XML. In fact, the .NET framework provides generic support for these through the
ResourceManager
class.
WPF is no different—binary resources play an important role in a typical application. However, WPF goes a lot further with another kind of resource: logical resources. These are objects, any objects, which can be shared and used in a multitude of locations throughout the application; they can even be accessed across assemblies. Some of WPF's features, such as implicit (automatic) styles and type-based data templates, rely on the logical resources system.
In this chapter, we'll take a look at resources, binary and logical, their definition, and usage in XAML and code, and discuss various options and typical scenarios, such as combining resources (even across assemblies) and resource lookup and modifications.