Windows Presentation Foundation (WPF)
WPF primarily is part of the System.Windows namespace which makes it easy for programmers with .NET Framework development experience using ASP.NET and Windows Forms to build rich client applications using a familiar programming language, such as C# or VB.NET.
WPF has additional programming enhancements for Windows client and browser-based application development. The most salient .NET Framework enhancement is the ability to develop an application using both markup and code-behind - an experience much like that of the ASP.NET programming paradigm. Designers can use Extensible Application Markup Language (XAML) markup to implement the appearance of an application while programmers can use managed programming languages (code-behind) to implement its processing behavior. This separation of appearance and behavior has the following 2 benefits:
1. Development and maintenance are enhanced because appearance-specific markup XAML is not tightly coupled with behavior-specific code in C# or VB.NET.
2. Development is more efficient because designers can implement an application's appearance with a tool like Expression Blend while developers are implementing the application's business logic and functional processes in Visual Studio 2008.
For browser-hosted applications, known as XAML browser applications (XBAPs), programmers can create pages (Page) and page functions (PageFunction<(Of <(T>)>)) that users can navigate between using hyperlinks (Hyperlink classes). WPF applications can be hosted in Internet Explorer 6, Internet Explorer 7, and Firefox. WPF offers the two options for alternative navigation hosts:
1. Frame, to host islands of navigable content in either pages or windows.
2. NavigationWindow, to host navigable content in an entire window.
Because XBAPs are hosted in a browser, security is important. In particular, a partial-trust security sandbox is used by XBAPs to enforce restrictions that are less than or equal to the restrictions imposed on HTML-based applications. Furthermore, each HTML feature that is safe to run from XBAPs in partial trust has been tested by Microsoft using a comprehensive security process.
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 Windows Internet Explorer).
Custom Control Libraries (non-executable assemblies containing reusable controls).
Class Libraries (non-executable assemblies that contain reusable classes).
Executable WPF applications commonly require a core set of functionality that includes:
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.
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.
WPF supports Web-style navigation using pages (Page) and hyperlinks (Hyperlink). Navigation can be implemented in a variety of ways that include:
Standalone pages that are hosted in Internet Explorer.
Pages compiled into an XBAP that is hosted in Internet Explorer.
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:
- NavigationService, the shared navigation engine for processing navigation requests that is used by Frame, NavigationWindow, and XBAPs to support intra-application navigation.
- 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.