-api-id | -api-type |
---|---|
M:Windows.Storage.Search.StorageItemQueryResult.FindStartIndexAsync(System.Object) |
winrt method |
Retrieves the index of the item from the query results that most closely matches the specified property value. The property that is matched is determined by the first SortEntry of the QueryOptions.SortOrder list.
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.
When this method completes successfully it returns the index of the matched item in the query results.
This example shows how to find the first item that has an album title that begins with an "R" in a set of query results that contains albums sorted by 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);
StorageFolderQueryResult queryResult = musicFolder.CreateItemQueryWithOptions(queryOptions);
var firstIndex = await queryResult.FindStartIndexAsync("R");