WebUISearchActivatedEventArgs class

Applies to Windows and Windows Phone

Provides information about the activated event that fires when the user searches the app from the Search charm and the app isn't the main app on screen.

C#/C++/VB:  This type appears as SearchActivatedEventArgs.

Syntax


/* For information about creating or accessing this object, see Remarks. */

Attributes

[MarshalingBehavior(Standard)]
[Version(0x06020000)]

Members

The WebUISearchActivatedEventArgs class has these types of members:

Methods

The WebUISearchActivatedEventArgs class inherits methods from the Object class (C#/VB/C++).

Properties

The WebUISearchActivatedEventArgs class has these properties.

PropertyAccess typeDescription

ActivatedOperation

Read-onlyGets the app activated operation.

CurrentlyShownApplicationViewId

Read-onlyGets the identifier for the currently shown app view.

Kind

Read-onlyGets the activation type.

Language

Read-onlyGets the Internet Engineering Task Force (IETF) language tag (BCP 47 standard) that identifies the language currently associated with the user's text input device.

LinguisticDetails

Read-onlyGets a SearchPaneQueryLinguisticDetails object that provides info about query text that the user enters through an Input Method Editor (IME).

PreviousExecutionState

Read-onlyGets the execution state of the app before it was activated.

QueryText

Read-onlyGets the text that the user wants the app to search for.

SplashScreen

Read-onlyGets the splash screen object that provides information about the transition from the splash screen to the activated app.

 

Remarks

If your app integrates with the Search contract, a webUISearchActivatedEventArgs is passed to your app's onactivated event handler when the user searches the app from the Search charm and your app is not the main app on screen. This type of activation is indicated by the activationKind.search value returned by the kind property.

Learn how to let users search with your app in Quickstart: Adding search. Learn about responding to other search-related events and customizing the search box and suggestions using the searchPane class in the Windows.ApplicationModel.Search namespace reference.

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX).

Examples

The Search contract sample demonstrates how to respond to a search activated event.


function activated(eventObject) {
    if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
        // Use setPromise to indicate to the system that the splash screen must not be torn down
        // until after processAll and navigate complete asynchronously.
        eventObject.setPromise(WinJS.UI.processAll().then(function () {
            // Navigate to either the first scenario or to the last running scenario
            // before suspension or termination.
            var url = WinJS.Application.sessionState.lastUrl || scenarios[0].url;
            return WinJS.Navigation.navigate(url);
        }));
    } else if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.search) {
        // Use setPromise to indicate to the system that the splash screen must not be torn down
        // until after processAll and navigate complete asynchronously.
        eventObject.setPromise(WinJS.UI.processAll().then(function () {
            if (eventObject.detail.queryText === "") {
                // Navigate to your landing page since the user is pre-scoping to your app.
            } else {
                // Display results in UI for eventObject.detail.queryText and eventObject.detail.language.
                // eventObject.detail.language represents user's locale.
            }
            // Navigate to the first scenario since it handles search activation.
            var url = scenarios[0].url;
            return WinJS.Navigation.navigate(url, { searchDetails: eventObject.detail });
        }));
    }
}

For JavaScript, eventObject contains a webUISearchActivatedEventArgs object.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.WebUI

Metadata

Windows.winmd

See also

Search contract sample

 

 

Show:
© 2014 Microsoft