private async void Find_Click(object sender, RoutedEventArgs e) { ContentTextOutput.Text = ""; if (FindQueryText.Text == "") { return; } 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. StorageFolder picturesLibrary = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.PicturesLibrary); StorageFileQueryResult queryResult = picturesLibrary.CreateFileQueryWithOptions(queryOptions); IReadOnlyList <StorageFile> files = await queryResult.GetFilesAsync(0, 20); // limit to 20 results 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"; } }