Share via


SearchPane Class

Definition

Deprecated. Use the Windows.UI.Xaml.Controls.AutoSuggestBox control instead. Represents and manages the search pane that opens when a user activates the Search charm.

public ref class SearchPane sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.ApplicationModel.Search.SearchContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("SearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.ApplicationModel.Search.SearchContract)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class SearchPane final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.ApplicationModel.Search.SearchContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
/// [Windows.Foundation.Metadata.Deprecated("SearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
class SearchPane final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.ApplicationModel.Search.SearchContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("SearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.ApplicationModel.Search.SearchContract))]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public sealed class SearchPane
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.ApplicationModel.Search.SearchContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
[Windows.Foundation.Metadata.Deprecated("SearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
public sealed class SearchPane
Public NotInheritable Class SearchPane
Inheritance
Object Platform::Object IInspectable SearchPane
Attributes

Windows requirements

Device family
Windows Desktop Extension SDK (introduced in 10.0.10240.0)
Xbox One Extensions for the UWP (introduced in 10.0.10586.0)
API contract
Windows.ApplicationModel.Search.SearchContract (introduced in v1.0)

Remarks

Important

To implement search in an app for Windows 10 or later, use AutoSuggestBox. See Auto-suggest box for more info.

You should not use Windows.ApplicationModel.Search APIs (SearchPane, SearchContract) or SearchBox APIs in apps for Windows 10 or later.

Note

An app can't use both the search box (Windows.UI.Xaml.Controls.SearchBox/WinJS.UI.SearchBox) 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.'"

This object is available to apps that participate in the Search contract. In order to provide users with search results, you must add code to your Activated event handler that responds when your app is activated for search. To learn more about responding to Search activation events, see webUISearchActivatedEventArgs (JavaScript) or SearchActivatedEventArgs (C#/C++/VB).

You can see code examples that demonstrate how to respond to search events and manage the search pane in the Search contract sample (Windows 8).

Properties

Language

The Internet Engineering Task Force (IETF) language tag (BCP 47 standard) that identifies the language currently associated with the user's text input device.

PlaceholderText

The placeholder text in the search box when the user hasn't entered any characters.

QueryText

The current text in the search box of the search pane.

SearchHistoryContext

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

SearchHistoryEnabled

Indicates whether the user's previous searches with the app are automatically tracked and used to provide suggestions.

ShowOnKeyboardInput

Gets or sets whether the user can open the search pane by typing.

Visible

Indicates whether the search pane is open.

Methods

GetForCurrentView()

Retrieves an instance of the search pane from which users can search within the app.

HideThisApplication()

Hides the current app's UI.

SetLocalContentSuggestionSettings(LocalContentSuggestionSettings)

Specifies whether suggestions based on local files are automatically displayed in the search pane, and defines the criteria that Windows uses to locate and filter these suggestions.

Show()

Shows the search pane.

Show(String)

Shows the search pane with the specified initial query string.

TrySetQueryText(String)

Attempts to set the text in the search box of the search pane.

Events

QueryChanged

Fires when the user changes the text in the search box.

QuerySubmitted

Fires when the user submits the text in the search box and the app needs to display search results.

ResultSuggestionChosen

Fires when the user selects one of the suggested results that was provided by the app and displayed in the search pane.

SuggestionsRequested

Occurs when the user's query text changes and the app needs to provide new suggestions to display in the search pane.

VisibilityChanged

Fires when the user opens or closes the search pane.

Applies to

See also