Application Development Overview
Windows Presentation Foundation (WPF) supports the creation of the following types of applications:
Standalone Applications (traditional style Windows applications built as executable assemblies that are installed to and run from the client machine).
XAML browser applications (XBAPs) (applications composed of navigable pages that are built as executable assemblies that are browsed to and hosted by Web browsers such as Windows Internet Explorer or Mozilla Firefox).
Custom Control Libraries (non-executable assemblies containing reusable controls).
Class Libraries (non-executable assemblies that contain reusable classes).
The use of WPF to build Windows services is unsupported. Because WPF is a presentation technology, the Windows service requires the appropriate permissions to perform visual operations that involve user interaction. If the Windows service does not have the appropriate permissions, there may be unexpected results.
To build this set of applications, WPF implements a host of services. This topic provides an overview of these services and where to find more information.
This topic contains the following sections.
Executable WPF applications commonly require a core set of functionality that includes the following:
Creating and managing common application infrastructure (including creating an entry point method and a Windows message loop to receive system and input messages).
Tracking and interacting with the lifetime of an application.
Retrieving and processing command-line parameters.
Sharing application-scope properties and UI resources.
Detecting and processing unhandled exceptions.
Returning exit codes.
Managing windows in standalone applications.
Tracking navigation in XAML browser applications (XBAPs), and standalone applications with navigation windows and frames.
These capabilities are implemented by the Application class, which you add to your applications using an application definition.
For more information, see Application Management Overview.
WPF leverages and extends the core support in the Microsoft .NET Framework for embedded resources with support for three kinds of non-executable data files: resource, content, and data. For more information, see Windows Presentation Foundation Application Resource, Content, and Data Files.
A key component of the support for WPF non-executable data files is the ability to identify and load them using a unique URI. For more information, see Pack URIs in Windows Presentation Foundation.
Users interact with WPF standalone applications through windows. The purpose of a window is to host application content and expose application functionality that usually allows users to interact with the content. In WPF, windows are encapsulated by the Window class, which supports:
Creating and showing windows.
Establishing owner/owned window relationships.
Configuring window appearance (for example, size, location, icons, title bar text, border).
Tracking and interacting with the lifetime of a window.
For more information, see WPF Windows Overview.
Window supports the ability to create a special type of window known as a dialog box. Both modal and modeless types of dialog boxes can be created.
For convenience, and the benefits of reusability and a consistent user experience across applications, WPF exposes three of the common Windows dialog boxes: OpenFileDialog, SaveFileDialog, and PrintDialog.
A message box is a special type of dialog box for showing important textual information to users, and for asking simple Yes/No/OK/Cancel questions. You use the MessageBox class to create and show message boxes.
For more information, see Dialog Boxes Overview.
Standalone pages that are hosted in a Web browser.
Pages compiled into an XBAP that is hosted in a Web browser.
Pages compiled into a standalone application and hosted by a navigation window (NavigationWindow).
Pages that are hosted by a frame (Frame), which may be hosted in a standalone page, or a page compiled into either an XBAP or a standalone application.
To facilitate navigation, WPF implements the following:
Navigation methods to initiate navigation.
Navigation events to track and interact with navigation lifetime.
Remembering back and forward navigation using "the journal," which can also be inspected and manipulated.
For information, see Navigation Overview.
WPF also supports a special type of navigation known as structured navigation. Structured navigation can be used to call one or more pages that return data in a structured and predictable way that is consistent with calling functions. This capability depends on the PageFunction<T> class, which is described further in Structured Navigation Overview. PageFunction<T> also serves to simplify the creation of complex navigation topologies, which are described in Navigation Topologies Overview.
XBAPs can be hosted in Windows Internet Explorer or Firefox. Each hosting model has its own set of considerations and constraints that are covered in the Hosting Windows Presentation Foundation Applications topic.
Although simple WPF applications can be built from a command prompt using command-line compilers, WPF integrates with and extends Microsoft build engine (MSBuild) to provide additional support that simplified the development and build process. For information, see Building a WPF Application (WPF).
Depending on the type of application you build, there are one or more deployment options to choose from. For more information, see Deploying a WPF Application (WPF).
For WPF -specific performance considerations, see Optimizing WPF Application Performance.