SearchPane.QueryChanged 事件

定义

当用户更改搜索框中的文本时触发。

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

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

// Revoke with event_revoker
SearchPane::QueryChanged_revoker QueryChanged(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneQueryChangedEventArgs 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 QueryChanged(TypedEventHandler<SearchPane, SearchPaneQueryChangedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
SearchPane::QueryChanged_revoker QueryChanged(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneQueryChangedEventArgs 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,SearchPaneQueryChangedEventArgs> QueryChanged;
[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,SearchPaneQueryChangedEventArgs> QueryChanged;
function onQueryChanged(eventArgs) { /* Your code */ }
searchPane.addEventListener("querychanged", onQueryChanged);
searchPane.removeEventListener("querychanged", onQueryChanged);
- or -
searchPane.onquerychanged = onQueryChanged;
Public Custom Event QueryChanged As TypedEventHandler(Of SearchPane, SearchPaneQueryChangedEventArgs) 

事件类型

属性

注解

重要

若要在应用中实现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'的实例。

注册以在触发此事件时收到通知,方法是将事件侦听器添加到 searchPane 并为事件分配处理程序函数。 可以使用传递给事件处理程序的 searchPaneQueryChangedEventArgs 对象访问有关事件的信息。

适用于

另请参阅