Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 2.57 KB

storagefilequeryresult_findstartindexasync_95345387.md

File metadata and controls

44 lines (32 loc) · 2.57 KB
-api-id -api-type
M:Windows.Storage.Search.StorageFileQueryResult.FindStartIndexAsync(System.Object)
winrt method

Windows.Storage.Search.StorageFileQueryResult.FindStartIndexAsync

-description

Retrieves the index of the file from the query results that most closely matches the specified property value (or file, if used with FileActivatedEventArgs.NeighboringFilesQuery). The property that is matched is determined by the first SortEntry of the QueryOptions.SortOrder list.

-parameters

-param value

The property value to match when searching the query results. The property to that is used to match this value is the property in the first SortEntry of the QueryOptions.SortOrder list.

Or, the file to match when searching with FileActivatedEventArgs.NeighboringFilesQuery.

-returns

When this method completes successfully, it returns the index of the matched file in the query results or the index of the file in the FileActivatedEventArgs.NeighboringFilesQuery. In the latter case, the file is expected to be sourced from FileActivatedEventArgs.Files. If this function fails, it returns uint.MaxValue.

-remarks

You can use this method in conjunction with FileActivatedEventArgs.NeighboringFilesQuery to iterate between neighboring files while preserving the original view's sort order.

-examples

This example shows how to find the first song in an album that has a title beginning with the "R" in a set of query results that contains songs grouped by album title.

QueryOptions queryOptions = new QueryOptions();
queryOptions.FolderDepth = FolderDepth.Deep;
queryOptions.IndexerOption = IndexerOption.OnlyUseIndexer;
SortEntry album = new SortEntry();
album.AscendingOrder = true;
album.PropertyName = "System.Music.AlbumTitle";
queryOptions.SortOrder.Add(album);

StorageFileQueryResult queryResult = musicFolder.CreateFileQueryWithOptions(queryOptions);
var firstIndex = await queryResult.FindStartIndexAsync("R");

-see-also