Microsoft
Windows applications often
depend on files that contain
non-executable data, such as
Extensible Application
Markup Language (XAML),
images, video, and audio.
Windows Presentation
Foundation (WPF) offers
special support for
configuring, identifying,
and using these types of
data files, which are called
application data files. This
support revolves around a
specific set of application
data file types, including:
-
Resource Files:
Data files that are
compiled into either an
executable or library
WPF assembly.
-
Content Files:
Standalone data files
that have an explicit
association with an
executable WPF assembly.
-
Site of Origin Files:
Standalone data files
that have no association
with an executable WPF
assembly.
One important distinction
to make between these three
types of files is that
resource files and content
files are known at build
time; an assembly has
explicit knowledge of them.
For site of origin files,
however, an assembly may
have no knowledge of them at
all, or implicit knowledge
through a pack uniform
resource identifier (URI)
reference; the case of the
latter, there is no
guarantee that the
referenced site of origin
file actually exists.
To reference application
data files, Windows
Presentation Foundation
(WPF) uses the Pack uniform
resource identifier (URI)
Scheme, which is described
in detail in
Pack URIs in WPF).
This topic describes how
to configure and use
application data files.
This topic contains the
following sections.
Resource Files
If an application
data file must always be
available to an
application, the only
way to guarantee
availability is to
compile it into an
application's main
executable assembly or
one of its referenced
assemblies. This type of
application data file is
known as a
resource file.
You should use
resource files when:
- You don't need
to update the
resource file's
content after it is
compiled into an
assembly.
- You want to
simplify application
distribution
complexity by
reducing the number
of file
dependencies.
- Your application
data file needs to
be localizable (see
WPF Globalization
and Localization
Overview).