Using binary resources
Binary resources are just that: chunks of bytes that typically mean something to the application, such as image or font files. In this recipe, we'll cover the basics of adding and using a binary resource.
Getting ready
Make sure Visual Studio is up and running.
How to do it...
We'll create a simple application that uses an image file added as a binary resource:
Create a new WPF Application named
CH02.BinaryResources
.Let's add a logical images folder to the project. Right-click the project node in Solution Explorer, and select Add | New Folder.
The folder is created as
NewFolder1
. Change its name toImages
.Right-click on the newly created Images folder, and select Add | Existing Item…:
Navigate to some image file on your system (don't forget to change the file type filter to Image files at the bottom of the open file dialog box). I've used
apple.png
(found in the downloadable source for this chapter), but any image will do, preferably no larger than 48 x 48 pixels. The solution...