Prev | Current Page 362 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

)
Next, when you use the font, you need to add the character sequence ./# before the font
family name, as shown here:

The ./ characters are interpreted by WPF to mean ???the current folder.??? To understand
what this means, you need to know a little more about XAML??™s packaging system.
CHAPTER 7 n CLASSIC CONTROLS 191
As you learned in Chapter 1, you can run stand-alone (known as loose) XAML files directly
in your browser without compiling them. The only limitation is that your XAML file can??™t use a
code-behind file. In this scenario, the current folder is exactly that, and WPF looks at the font
files that are in the same directory as the XAML file and makes them available to your application.
More commonly, you??™ll compile your WPF application to a .NET assembly before you run
it. In this case, the current folder is still the location of the XAML document, only now that
document has been compiled and embedded in your assembly. WPF refers to compiled
resources using a specialized URI syntax that??™s discussed in Chapter 11. All application URIs
start with pack://application. If you create a project named ClassicControls and add a window
named EmbeddedFont.xaml, the URI for that window is this:
pack://application:,,,/ClassicControls/embeddedfont.


Pages:
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374