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.
Syntax
var localContentSuggestionSettings = new Windows.ApplicationModel.Search.LocalContentSuggestionSettings();
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- MarshalingBehaviorAttribute(Standard)
- VersionAttribute(NTDDI_WIN8)
Members
The LocalContentSuggestionSettings class has these types of members:
Constructors
The LocalContentSuggestionSettings class has these constructors.
| Constructor | Description |
|---|---|
| LocalContentSuggestionSettings | Creates a new instance of the localContentSuggestionSettings class. |
Methods
The LocalContentSuggestionSettings class inherits methods from the Object class (C#/VB/C++).
Properties
The LocalContentSuggestionSettings class has these properties.
| Property | Access type | Description |
|---|---|---|
| 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. |
Remarks
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).
Examples
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).
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
- Search contract sample
- Quickstart: Adding search
- Advanced Query Syntax (AQS)
- Reference
- SearchPane class
- SearchPane.setLocalContentSuggestionSettings method
Build date: 12/4/2012