Window.WindowStartupLocation Property (System.Windows)

Switch View :
ScriptFree
.NET Framework Class Library
Window.WindowStartupLocation Property

Gets or sets the position of the window when first shown.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax

Visual Basic
Public Property WindowStartupLocation As WindowStartupLocation
	Get
	Set
C#
public WindowStartupLocation WindowStartupLocation { get; set; }
Visual C++
public:
property WindowStartupLocation WindowStartupLocation {
	WindowStartupLocation get ();
	void set (WindowStartupLocation value);
}
F#
member WindowStartupLocation : WindowStartupLocation with get, set

XAML Attribute Usage
<object WindowStartupLocation="WindowStartupLocation" .../>

Property Value

Type: System.Windows.WindowStartupLocation
A WindowStartupLocation value that specifies the top/left position of a window when first shown. The default is Manual.
Remarks

Setting WindowStartupLocation to Manual causes a window to be positioned according to its Left and Top property values. If either the Left or Top properties aren't specified, their values are determined by Windows.

Setting CenterScreen causes a window to be positioned in the center of the screen that contains the mouse cursor.

Setting WindowStartupLocation to CenterOwner causes a window to be positioned in the center of its owner window (see Owner), if specified. The owner window can be either another WPF window or a non-WPF window.

Note Note

For more information about WPF windows with non-WPF windows, see WPF and Win32 Interoperation and WindowInteropHelper.

If an owner window is not specified, the position of the window is determined in the same way as if WindowStartupLocation is set to Manual.

Note Note

You cannot set or get the value of this property when a window is hosted in a browser.

Version Information

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also

Reference