Using logical resources
WPF introduces the concept of logical resources, objects that can be shared (and reused) across some part of a visual tree or an entire application. Logical resources can be anything, from WPF objects such as brushes, geometries, or styles, to other objects defined by the .NET Framework or the developer, such as string
, List<>
, or some custom typed object. This gives a whole new meaning to the term resources. These objects are typically placed inside a ResourceDictionary
and located at runtime using a hierarchical search, as demonstrated in this recipe.
Getting ready
Make sure Visual Studio is up and running.
How to do it...
We'll create a simple application that demonstrates creating and using logical resources:
- Create a new ...
Get Windows Presentation Foundation 4.5 Cookbook 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.