Share via


SearchPane.ResultSuggestionChosen Event

Definition

Fires when the user selects one of the suggested results that was provided by the app and displayed in the search pane.

/// [add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.ApplicationModel.Search.SearchContract)]
/// [remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.ApplicationModel.Search.SearchContract)]
// Register
event_token ResultSuggestionChosen(TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;

// Revoke with event_token
void ResultSuggestionChosen(event_token const* cookie) const;

// Revoke with event_revoker
SearchPane::ResultSuggestionChosen_revoker ResultSuggestionChosen(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;
/// [add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
/// [remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
// Register
event_token ResultSuggestionChosen(TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;

// Revoke with event_token
void ResultSuggestionChosen(event_token const* cookie) const;

// Revoke with event_revoker
SearchPane::ResultSuggestionChosen_revoker ResultSuggestionChosen(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;
[add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.ApplicationModel.Search.SearchContract))]
[remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.ApplicationModel.Search.SearchContract))]
public event TypedEventHandler<SearchPane,SearchPaneResultSuggestionChosenEventArgs> ResultSuggestionChosen;
[add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
[remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
public event TypedEventHandler<SearchPane,SearchPaneResultSuggestionChosenEventArgs> ResultSuggestionChosen;
function onResultSuggestionChosen(eventArgs) { /* Your code */ }
searchPane.addEventListener("resultsuggestionchosen", onResultSuggestionChosen);
searchPane.removeEventListener("resultsuggestionchosen", onResultSuggestionChosen);
- or -
searchPane.onresultsuggestionchosen = onResultSuggestionChosen;
Public Custom Event ResultSuggestionChosen As TypedEventHandler(Of SearchPane, SearchPaneResultSuggestionChosenEventArgs) 

Event Type

Attributes

Remarks

Important

To implement search in an app for Windows 10 or later, use AutoSuggestBox. See Auto-suggest box for more info.

You should not use Windows.ApplicationModel.Search APIs (SearchPane, SearchContract) or SearchBox APIs in apps for Windows 10 or later.

Note

An app can't use both the search box (Windows.UI.Xaml.Controls.SearchBox/WinJS.UI.SearchBox) and the SearchPane. Using both the search box and the search pane in the same app causes the app to throw an exception with this message: "Cannot create instance of type 'Windows.UI.Xaml.Controls.SearchBox.'"

If your app participates in the Search contract and displays suggestions for possible results in the search pane, you should register an event handler to respond when this event fires. In your ResultSuggestionChosen event handler, respond by getting the SearchPaneResultSuggestionChosenEventArgs.Tag of the chosen result and using it to take the user to the result in your app UI.

Note

If you want to display result suggestions, you must also listen for and handle the SuggestionsRequested event.

Applies to

See also