SearchPane.SetLocalContentSuggestionSettings | setLocalContentSuggestionSettings method

Applies to Windows only

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.


public void SetLocalContentSuggestionSettings(
  LocalContentSuggestionSettings settings



Type: LocalContentSuggestionSettings

The new settings for local content suggestions.


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 Store 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.'"

When local content suggestions are enabled, Windows will provide search suggestions from the user's local files as the user enters query text. For example, a picture application can configure local content suggestions so that search suggestions come only from a particular kind of image file that is stored in the user's picture library.


The Search contract sample demonstrates how to customize local suggestions by restricting the locations and kinds of files that the suggestions are based on.

Tip  You should add this code to your app's global scope and run it as soon as your app is launched.

// Have Windows provide suggestions from local files.
// This code should be placed in your apps global scope and run as soon as your app is launched.
var settings = new LocalContentSuggestionSettings();
settings.Enabled = true;
if (isLocal)
    settings.AqsFilter = "kind:Music";

In the example, suggestions are restricted to one kind of file, music files, using an AQS string. Two of the most common AQS filters restrict based on file kind, like "" in the example; and based on file name extension, like "ext:=.mp3". You can learn more about AQS in Advanced Query Syntax (AQS).


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

None supported


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



See also

Advanced Query Syntax (AQS)
Quickstart: Adding search
Search contract sample
LocalContentSuggestionSettings class
SearchPane class



© 2014 Microsoft