LocalContentSuggestionSettings LocalContentSuggestionSettings LocalContentSuggestionSettings LocalContentSuggestionSettings LocalContentSuggestionSettings Class

Definition

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.

public : sealed class LocalContentSuggestionSettings
struct winrt::Windows::ApplicationModel::Search::LocalContentSuggestionSettings
public sealed class LocalContentSuggestionSettings
Public NotInheritable Class LocalContentSuggestionSettings
var localContentSuggestionSettings = new localContentSuggestionSettings();
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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.

// 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.Locations.Add(KnownFolders.MusicLibrary);
    settings.AqsFilter = "kind:Music";
}
SearchPane.GetForCurrentView().SetLocalContentSuggestionSettings(settings);
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 Advanced Query Syntax (AQS) string. Two of the most common Advanced Query Syntax (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 Advanced Query Syntax (AQS) in .

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).

Constructors

LocalContentSuggestionSettings() LocalContentSuggestionSettings() LocalContentSuggestionSettings() LocalContentSuggestionSettings() LocalContentSuggestionSettings()

Creates a new instance of the localContentSuggestionSettings class.

Properties

AqsFilter AqsFilter AqsFilter AqsFilter AqsFilter

An Advanced Query Syntax (AQS) string that limits the types and kinds of files that are used to provide suggestions. If no Advanced Query Syntax (AQS) string is specified, suggestions are provided from all local files in locations specified by the locations property.

Enabled Enabled Enabled Enabled Enabled

Indicates whether suggestions based on local files are displayed in the search pane.

Locations Locations Locations Locations Locations

A list of the storageFolder objects that contain files that are used to provide suggestions. If the list is empty, suggestions are provided from files in all of the local libraries for which the app declared capabilities.

PropertiesToMatch PropertiesToMatch PropertiesToMatch PropertiesToMatch PropertiesToMatch

A list of the file properties whose values are used to provide suggestions from local files. If the list is empty, all of the file properties that are available for suggestions are used.

See also