Using binary resources from another assembly
It is not mandatory to have the resources defined in the same assembly where they are going to be used. Sometime, on an as-needed basis, the binary resources are defined in one assembly (generally, a class library), and used in another assembly.
WPF provides a uniform way of accessing these resources defined in other assemblies. To work with this, we need to use the pack URI scheme. In this recipe, we will learn how to use binary resources from another assembly.
Getting ready
Let's begin with creating a new project called CH07.RemoteBinaryResourceDemo
. Make sure you select the WPF app template while creating this project.
How to do it...
Follow these steps to create a class library to define the binary resource and use it from the application that we have already created:
- Create another project within the same solution. Let's name it
CH07.ResourceLibrary
, and make sure you selectClass Library (.NET Framework)
as the project template:

- Remove the autogenerated...