Partager via


Adding search to an app (XAML)

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

Use the SearchBox control and the Search contract to let users search your app.

The search box provides the UI for performing searches and showing suggestions. The search box supports app-supplied search suggestions and results, app-specific search history, and full support for touch, keyboard, and mouse interactions.

The search box layout looks like this.

Here are example search results displayed in the search box control.

Search results will be displayed by your app. You must design and create a view for your app that displays the user's search results in a way that is coherent and relevant to the user's needs and that aligns with the purpose of your app.

See Guidelines and checklist for search to learn about creating a good search experience for your users.

To learn how to use the search box, check out the SearchBox control sample.

The Search contract

Use the Search contract to respond to Search activations.

Search in Windows 8 apps

Prior to Windows 8.1, apps used the Search charm to provide in-app search. Developers implemented the Search contract and used the SearchPane API to handle queries and obtain suggestions and results.

Although we continue to fully support the Windows 8 Search contract, as of Windows 8.1, we recommend using the Search charm for global searches. In-app search should use the SearchBox control instead of the SearchPane. Apps that use the SearchBox don't need to implement the Search contract.

In this section

Topic Description

Quickstart

Learn how to enable users search your app.

 

Windows.UI.Xaml.Controls.SearchBox

Guidelines and checklist for search

SearchBox control sample