Activate method

Window.Activate method

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


public void Activate()


This method has no parameters.


If you use the default app templates from Microsoft Visual Studio, Window.Activate is part of the initial code in the app.xaml code-behind file. Specifically, Activate is called from the default OnLaunched override. In cases where the template produces a page navigation experience, previous states are detected so that the navigation framework isn't overwritten if it already existed, but Activate is called regardless.

Calling Activate is required for all app activation scenario, not just app launch.

This method is important for the correct operation of an app. If an app does not call Activate on the Current window, and the app is not visible on screen, then the app will be terminated after 15 seconds. If the app or its splash screen is kept on screen there is no time limit, but eventually the app needs to call Activate to progress. Also, certain app contracts extend the time limit.

You can modify the default OnLaunched implementation in order to delay calling Activate. You might do this to have all app rendering be complete before the main Window is shown. For example, a delay can be useful to finish loading Image source files in the initial UI. (These load asynchronously and it's impractical to handle ImageOpened from app.xaml code-behind.) On the other hand, delaying the call can create an undesirable user experience if the splash screen is visible for too long.

For secondary windows, you also need to call Activate. Secondary windows are an uncommon scenario for most Windows Store apps using C++, C#, or Visual Basic.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml [C++]



See also

Handle app activation



© 2017 Microsoft