SearchPane.SearchHistoryContext 屬性

定義

識別搜尋內容的字串,用來儲存使用者的搜尋歷程記錄與應用程式。

public:
 property Platform::String ^ SearchHistoryContext { Platform::String ^ get(); void set(Platform::String ^ 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)]
winrt::hstring SearchHistoryContext();

void SearchHistoryContext(winrt::hstring 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")]
winrt::hstring SearchHistoryContext();

void SearchHistoryContext(winrt::hstring value);
public string SearchHistoryContext { [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 string SearchHistoryContext { [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 string = searchPane.searchHistoryContext;
searchPane.searchHistoryContext = string;
Public Property SearchHistoryContext As String

屬性值

String

Platform::String

winrt::hstring

搜尋歷程記錄內容字串。

屬性

備註

重要

若要在應用程式中實作Windows 10或更新版本的搜尋,請使用AutoSuggestBox。 如需詳細資訊 ,請參閱自動建議方塊

您不應該在 app 中使用Windows.ApplicationModel.Search API (SearchPaneSearchContract) 或SearchBox API,以供Windows 10或更新版本使用。

注意

應用程式無法使用搜尋方塊 (Windows.UI.Xaml.Controls.SearchBoxWinJS.UI.SearchBox/) 和 SearchPane。 在相同的應用程式中同時使用搜尋方塊和搜尋窗格,會導致應用程式擲回例外狀況,並出現下列訊息:「無法建立類型為 'Windows.UI.Xaml.Controls.SearchBox' 的實例」。

搜尋歷程記錄內容字串是用來儲存搜尋歷程記錄的次要索引鍵, (主鍵是 AppId) 。 應用程式可以使用搜尋歷程記錄內容字串,根據應用程式的內容來儲存不同的搜尋歷程記錄。

如果您未設定此屬性,Windows 會假設您應用程式中的所有搜尋都發生在相同的內容中。 如果您在搜尋窗格開啟時更新此屬性,並顯示建議,則除非使用者輸入下一個字元,變更才會生效。

適用於

另請參閱