Stores settings that determine whether the app provides suggestions based on local files, and that define the criteria used to locate and filter these suggestions.
var localContentSuggestionSettings = new Windows.ApplicationModel.Search.LocalContentSuggestionSettings();
The LocalContentSuggestionSettings class has these types of members:
The LocalContentSuggestionSettings class has these constructors.
|LocalContentSuggestionSettings||Creates a new instance of the localContentSuggestionSettings class.|
The LocalContentSuggestionSettings class has these properties.
|Read/write||An Advanced Query Syntax (AQS) string that limits the types and kinds of files that are used to provide suggestions.|
|Read/write||Indicates whether suggestions based on local files are displayed in the search pane.|
|Read-only||A list of the storageFolder objects that contain files that are used to provide suggestions.|
|Read-only||A list of the file properties whose values are used to provide suggestions from local files.|
The suggestions that the app provides are based on metadata fields and properties on the user's local, indexed files.
If enabled, local suggestions are displayed in the search pane when the user enters a query in the search box.
Disable these suggestions by setting the enabled property to false.
Note : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).
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.
var settings = new Windows.ApplicationModel.Search.LocalContentSuggestionSettings(); settings.enabled = true; settings.locations.append(Windows.Storage.KnownFolders.musicLibrary); settings.aqsFilter = "kind:=music"; Windows.ApplicationModel.Search.SearchPane.getForCurrentView().setLocalContentSuggestionSettings(settings);
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 "kind:=.music" 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 [Windows Store apps only]|
Minimum supported server
|Windows Server 2012 [Windows Store apps only]|
Minimum supported phone
- Search contract sample
- Quickstart: Adding search
- Advanced Query Syntax (AQS)
- SearchPane class
- SearchPane.setLocalContentSuggestionSettings method