Windows.Storage.Search.QueryOptions.SetPropertyPrefetch C# (CSharp) Method

SetPropertyPrefetch() public method

public SetPropertyPrefetch ( [ options, [ propertiesToRetrieve ) : void
options [
propertiesToRetrieve [
return void
		public extern void SetPropertyPrefetch([In] PropertyPrefetchOptions options, [In] IIterable<string> propertiesToRetrieve);
	}

Usage Example

        private async void Find_Click(object sender, RoutedEventArgs e)
        {
            ContentTextOutput.Text = "";
            List <string> propertyNames = new List <string>();

            propertyNames.Add("System.FileName");
            var queryOptions = new Windows.Storage.Search.QueryOptions();

            queryOptions.IndexerOption    = Windows.Storage.Search.IndexerOption.OnlyUseIndexer;
            queryOptions.UserSearchFilter = FindQueryText.Text;
            queryOptions.SetPropertyPrefetch(Windows.Storage.FileProperties.PropertyPrefetchOptions.DocumentProperties, propertyNames);

            // Query the Pictures library.
            StorageFileQueryResult      queryResult = Windows.Storage.KnownFolders.PicturesLibrary.CreateFileQueryWithOptions(queryOptions);
            IReadOnlyList <StorageFile> files       = await queryResult.GetFilesAsync();

            foreach (StorageFile file in files)
            {
                IDictionary <String, IReadOnlyList <Windows.Data.Text.TextSegment> > fileRangeProperties = queryResult.GetMatchingPropertiesWithRanges(file);
                if (fileRangeProperties.ContainsKey("System.FileName"))
                {
                    IReadOnlyList <Windows.Data.Text.TextSegment> ranges;
                    fileRangeProperties.TryGetValue("System.FileName", out ranges);
                    rootPage.HighlightRanges(ContentTextOutput, file.DisplayName, ranges);
                }
                // Note: You can continue looking for other properties you would like to highlight on the file here.
            }
            if (files.Count == 0)
            {
                ContentTextOutput.Text = "There were no matching files in your Pictures Library";
            }
        }
All Usage Examples Of Windows.Storage.Search.QueryOptions::SetPropertyPrefetch