Window.Activate Method

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

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)


<SecuritySafeCriticalAttribute> _
Public Function Activate As Boolean
public bool Activate()

Return Value

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


Exception Condition

The application is not running outside the browser.


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


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


Supported in: 5, 4


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