-
Book Overview & Buying
-
Table Of Contents
Windows Presentation Foundation 4.5 Cookbook
By :
Accessing a binary resource in XAML is pretty straightforward, but this works for standard resources such as images. Other types of resources may be used in code, and this requires a different approach.
Make sure Visual Studio is up and running.
We'll create an application that shows book information read programmatically from an XML file stored as a resource:
Create a new WPF Application named CH02.BinaryResourcesInCode.
Add the books.xml (found in the downloadable source for this chapter) file as a resource (make sure Build Action is set to Resource). As an alternative, you can create the file yourself and type its contents as shown in the next step.
The books.xml file looks something like the following:
<Books>
<Book Name="Windows Internals" Author="Mark Russinovich" />
<Book Name="Essential COM" Author="Don Box" />
<Book Name="Programming Windows with MFC"
Author="Jeff Prosise" />
<...