Skip to main content
WebUISearchActivatedEventArgs.queryText property

Applies to Windows and Windows Phone

Gets the text that the user wants the app to search for. The user entered this text into the search box of the search pane.


var queryText = webUISearchActivatedEventArgs.queryText;

Property value

Type: String

The text to search for.


The Search contract sample demonstrates how to use the queryText property in the app's activated event handler to determine whether the app should display a view of search results or the app's default, home view (if queryText is empty).

var detail = e.detail;
// Check if this is search activation
if (detail.kind === {
    sdkSample.displayStatus("Activated for Search with the query: " + detail.queryText);
    if (detail.queryText === "") {
        // Navigate to your landing page since the user is pre-scoping to your app
    } else {
        // Display results in UI for detail.queryText and detail.language
        // detail.language represents user's locale
} else { // Non Search Activation
    // Other Activation Code

In the example, e is a webUISearchActivatedEventArgs object.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]





See also