Window.WindowStartupLocation Property

Definition

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

public System.Windows.WindowStartupLocation WindowStartupLocation { get; set; }

Property Value

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

Remarks

Setting the WindowStartupLocation property 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 the WindowStartupLocation property to CenterScreen causes a window to be positioned in the center of the screen that contains the mouse cursor.

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

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 the WindowStartupLocation property is set to Manual.

Note

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

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9