Share via


SearchPane.SearchHistoryEnabled 属性

定义

指示用户以前对应用的搜索是否自动跟踪并用于提供建议。

public:
 property bool SearchHistoryEnabled { bool get(); void set(bool value); };
/// [get: 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)]
/// [set: 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)]
bool SearchHistoryEnabled();

void SearchHistoryEnabled(bool value);
/// [get: 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")]
/// [set: 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")]
bool SearchHistoryEnabled();

void SearchHistoryEnabled(bool value);
public bool SearchHistoryEnabled { [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))] get; [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))] set; }
public bool SearchHistoryEnabled { [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")] get; [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")] set; }
var boolean = searchPane.searchHistoryEnabled;
searchPane.searchHistoryEnabled = boolean;
Public Property SearchHistoryEnabled As Boolean

属性值

Boolean

bool

如果自动跟踪用户的搜索历史记录并用于提供建议,则为 True;否则为 false。 默认值为 true。

属性

注解

重要

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

可以将此属性设置为 false 以选择退出自动建议;你的应用可以选择性地向用户提供自己的建议。 如果你决定让应用跟踪自己的搜索历史记录,则还应通过“设置”超级按钮向用户提供对其历史记录的一些控制,例如清除历史记录的功能。

如果在搜索窗格打开时设置此属性,则更改在用户输入其查询的下一个字符之前不会生效。

适用于

另请参阅