Window.Activate Method

Attempts to activate the application window by bringing it to the foreground and setting the input focus to it.

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function Activate As Boolean
[SecuritySafeCriticalAttribute]
public bool Activate()

Return Value

Type: System.Boolean
true if the window was successfully activated; otherwise, false.

Exceptions

Exception Condition
NotSupportedException

The application is not running outside the browser.

UnauthorizedAccessException

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

Remarks

The rules that determine whether the window is activated are the same as those used by the Win32 SetForegroundWindow function (User32.dll).

Use the IsActive property to determine whether the window is already active.

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.