Udostępnij za pośrednictwem


Window.TopMost Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates whether the application window is always displayed in front of other windows.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property TopMost As Boolean
public bool TopMost { get; set; }

Property Value

Type: System.Boolean
true if the application window is topmost; otherwise, false. The default is false.

Exceptions

Exception Condition
NotSupportedException

The application is not running outside the browser.

UnauthorizedAccessException

The current thread is not the user interface (UI) thread.

SecurityException

When setting this property, except in response to a user-initiated action, the Application.Startup event has already occurred and Application.HasElevatedPermissions is false.

Remarks

You can set this property only in the following cases:

If multiple applications have main windows with TopMost values of true, the actual topmost window is the one most recently active.

In Silverlight 5, trusted, out-of-browser applications can create multiple Window instances and manipulate them programmatically. However, the TopMost property is meaningful only for the Application.MainWindow instance.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.