Accessing binary resources from another assembly
Sometimes binary resources are defined in one assembly (typically a class library), but are needed in another assembly (another class library or an executable). WPF provides a uniform and consistent way of accessing these resources using the pack URI scheme. Let's see how to do this.
Getting ready
Make sure Visual Studio is up and running.
How to do it...
We'll create two assemblies—one that holds resources, and another that needs to use those resources:
- Create a new blank solution by selecting File | New Project from the main menu and then navigating to Other Project Types | Visual Studio Solutions. Name it
BinaryResourceAccess
: - Right-click on the Solution node in Solution explorer, and select Add | ...
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.