SearchHistoryContext | searchHistoryContext property

SearchPane.SearchHistoryContext | searchHistoryContext property

A string that identifies the context of the search and is used to store the user's search history with the app.


var searchHistoryContext = searchPane.searchHistoryContext;
searchPane.searchHistoryContext = searchHistoryContext;

Property value

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The search history context string.


Note  An app can't use both the search box (Windows.UI.Xaml.Controls.SearchBox for Windows Store apps using C++, C#, or Visual Basic, WinJS.UI.SearchBox for Windows apps using JavaScript) 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.'"

The search history context string is used as a secondary key for storing search history. (The primary key is the AppId.) An app can use the search history context string to store different search histories based on the context of the application.

If you don't set this property, Windows assumes that all searches in your app occur in the same context. If you update this property while the search pane is open with suggestions showing, the changes won't take effect until the user enters the next character.

Requirements (Windows 10 device family)

Device family

Desktop, introduced version 10.0.10240.0
Xbox, introduced version 10.0.10586.0

API contract

Windows.ApplicationModel.Search.SearchContract, introduced version 1.0


Windows::ApplicationModel::Search [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

None supported


Windows::ApplicationModel::Search [C++]



See also

SearchPane class
SearchPane.SearchHistoryEnabled property



© 2016 Microsoft