Updated: February 2009
Provides the ability to create, configure, show, and manage the lifetime of windows and dialog boxes.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
The point of interaction between a user and a standalone application is a window. A Windows Presentation Foundation (WPF) window consists of two distinct areas:
A non-client area, which hosts the windows adornments, including an icon, title, System menu, minimize button, maximize button, restore button, close button, and a border.
A client area, which hosts application-specific content.
A standard window is shown in the following figure:
encapsulates the ability to create, configure, show, and manage the lifetime of both windows and dialog boxes, and provides the following key services:
Appearance and Behavior: AllowsTransparency, ContentRendered, DragMove, Icon, Left, LocationChanged, ResizeMode, RestoreBounds, ShowActivated, ShowInTaskbar, SizeToContent, StateChanged, Title, Top, Topmost, WindowStartupLocation, WindowState, WindowStyle
Additionally, Application exposes special support for managing all of the windows in an application:
Application maintains a list of all the windows that are currently instantiated in the application. This list is exposed by the Windows property.
By default, MainWindow is automatically set with a reference to the first that is instantiated in an application. This thereby making the window the main application window.
A can be implemented using markup, markup and code-behind, or code.
is primarily used to display windows and dialog boxes for standalone applications. However, for applications that require navigation at the window level, such as wizards, you can use NavigationWindow instead; NavigationWindow derives from and extends it with browser-style navigation support.
Islands of navigable content can be incorporated into other content and content containers using Frame.
needs UnmanagedCode security permission to be instantiated. This has the following consequences:
ClickOnce-deployed standalone applications will request permission elevation when launched from either the Internet or Local Intranet zones.
XBAPs that request anything less than full permissions will not be able to instantiate windows or dialog boxes.
For information about standalone application deployment and security considerations, see Windows Presentation Foundation Security Strategy - Platform Security.
Content Model: is a ContentControl, which means that can contain content such as text, images, or panels. Also, is a root element and, consequently, cannot be part of another element's content. For more information about the content model for , see Content Models.
Dependency properties for this control might be set by the control’s default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see Themes.
The following example shows how a standard window is defined using only markup:
The following example shows how a standard window is defined using only code:
The following example shows how a standard window is defined using a combination of markup and code-behind.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.