WebUISearchActivatedEventArgs WebUISearchActivatedEventArgs WebUISearchActivatedEventArgs WebUISearchActivatedEventArgs Class

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

Declaration

public sealed class WebUISearchActivatedEventArgspublic sealed class WebUISearchActivatedEventArgsPublic NotInheritable Class WebUISearchActivatedEventArgs

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 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 ActivationKind 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.

Properties summary

Gets the app activated operation.

Gets the identifier for the currently shown app view.

Gets the activation type.

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

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

Gets the execution state of the app before it was activated.

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.

Gets the splash screen object that provides information about the transition from the splash screen to the activated app.

Properties

  • ActivatedOperation
    ActivatedOperation
    ActivatedOperation
    ActivatedOperation

    Gets the app activated operation.

    public ActivatedOperation ActivatedOperation { get; }public ActivatedOperation ActivatedOperation { get; }Public ReadOnly Property ActivatedOperation As ActivatedOperation

    Property Value

  • CurrentlyShownApplicationViewId
    CurrentlyShownApplicationViewId
    CurrentlyShownApplicationViewId
    CurrentlyShownApplicationViewId

    Gets the identifier for the currently shown app view.

    public int CurrentlyShownApplicationViewId { get; }public int CurrentlyShownApplicationViewId { get; }Public ReadOnly Property CurrentlyShownApplicationViewId As int

    Property Value

    • int
      int
      int
      int

      The identifier for the currently shown app view.

  • Kind
    Kind
    Kind
    Kind

    Gets the activation type.

    public ActivationKind Kind { get; }public ActivationKind Kind { get; }Public ReadOnly Property Kind As ActivationKind

    Property Value

    Remarks

    Examples

    The Search contract sample demonstrates how to determine when an app is activated for search in the app's activated event handler.

    [TODO:AUTO_SNIPPET (SAMPLE_ID:searchextension)(SNIPPET_ID:searchkind_js)]In the sample, e is a WebUISearchActivatedEventArgs object. The sample checks the e.QueryText property to determine whether the app should display results for the query.

  • Language
    Language
    Language
    Language

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

    public string Language { get; }public string Language { get; }Public ReadOnly Property Language As string

    Property Value

    • string
      string
      string
      string

      The Internet Engineering Task Force (IETF) BCP 47 standard language tag.

  • LinguisticDetails
    LinguisticDetails
    LinguisticDetails
    LinguisticDetails

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

    public SearchPaneQueryLinguisticDetails LinguisticDetails { get; }public SearchPaneQueryLinguisticDetails LinguisticDetails { get; }Public ReadOnly Property LinguisticDetails As SearchPaneQueryLinguisticDetails

    Property Value

  • PreviousExecutionState
    PreviousExecutionState
    PreviousExecutionState
    PreviousExecutionState

    Gets the execution state of the app before it was activated.

    public ApplicationExecutionState PreviousExecutionState { get; }public ApplicationExecutionState PreviousExecutionState { get; }Public ReadOnly Property PreviousExecutionState As ApplicationExecutionState

    Property Value

  • QueryText
    QueryText
    QueryText
    QueryText

    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.

    public string QueryText { get; }public string QueryText { get; }Public ReadOnly Property QueryText As string

    Property Value

    • string
      string
      string
      string

      The text to search for.

    Remarks

    Examples

    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).

    [TODO:AUTO_SNIPPET (SAMPLE_ID:searchextension)(SNIPPET_ID:searchkind_js)]In the example, e is a WebUISearchActivatedEventArgs object.

  • SplashScreen
    SplashScreen
    SplashScreen
    SplashScreen

    Gets the splash screen object that provides information about the transition from the splash screen to the activated app.

    public SplashScreen SplashScreen { get; }public SplashScreen SplashScreen { get; }Public ReadOnly Property SplashScreen As SplashScreen

    Property Value

    Remarks

    Examples

    The Splash screen sample demonstrates how to retrieve a SplashScreen object in its Activated event handler, if the app was launched:

    
    // Identify and respond to all app activated events.
    WinJS.Application.onactivated = function (eventObject) {
    
        // App was launched
        if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
            // Retrieve splash screen object
            splash = eventObject.detail.splashScreen;
    
            // Add code get image coordinates or listen for the dismissed event
    
            WinJS.UI.processAll();
        }
        // Add code to respond to other activated event types
    };
    

    In the sample, eventObject is an object provides information about the activated event. In the case of a ActivationKind activated event, the eventObject is a WebUILaunchActivatedEventArgs object.

Device family

Windows Desktop Extension SDK (introduced v10.0.10240.0)
Windows Mobile Extension SDK (introduced v10.0.10240.0)

API contract

Windows.ApplicationModel.Activation.WebUISearchActivatedEventsContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.UI.WebUI.dll