SearchPane.QuerySubmitted 事件

定义

当用户在搜索框中提交文本并且应用需要显示搜索结果时触发。

/// [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 QuerySubmitted(TypedEventHandler<SearchPane, SearchPaneQuerySubmittedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
SearchPane::QuerySubmitted_revoker QuerySubmitted(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneQuerySubmittedEventArgs 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 QuerySubmitted(TypedEventHandler<SearchPane, SearchPaneQuerySubmittedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
SearchPane::QuerySubmitted_revoker QuerySubmitted(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneQuerySubmittedEventArgs 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,SearchPaneQuerySubmittedEventArgs> QuerySubmitted;
[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,SearchPaneQuerySubmittedEventArgs> QuerySubmitted;
function onQuerySubmitted(eventArgs) { /* Your code */ }
searchPane.addEventListener("querysubmitted", onQuerySubmitted);
searchPane.removeEventListener("querysubmitted", onQuerySubmitted);
- or -
searchPane.onquerysubmitted = onQuerySubmitted;
Public Custom Event QuerySubmitted As TypedEventHandler(Of SearchPane, SearchPaneQuerySubmittedEventArgs) 

事件类型

属性

注解

重要

若要在应用中实现Windows 10或更高版本的搜索,请使用 AutoSuggestBox。 有关详细信息 ,请参阅自动建议框

不应在适用于 Windows 10 或更高版本的应用中使用 Windows.ApplicationModel.Search API (SearchPaneSearchContract) 或 SearchBox API。

注意

应用不能同时使用搜索框 (Windows.UI.Xaml.Controls.SearchBox/WinJS.UI.SearchBox) 和 SearchPane。 在同一应用中同时使用搜索框和搜索窗格会导致应用引发异常,并显示以下消息:“无法创建类型为'Windows.UI.Xaml.Controls.SearchBox'的实例。

如果应用参与搜索协定,请注册事件处理程序,以在触发此事件时做出响应。 在 QuerySubmitted 事件处理程序中,通过将用户带到搜索结果页并使用基于 SearchPaneQuerySubmittedEventArgs 的结果来响应。QueryText

适用于

另请参阅