Share via


ItemsSourceView.IndexFromKey(String) 方法

定义

检索具有指定唯一标识符的项的索引 (键) 。

public:
 virtual int IndexFromKey(Platform::String ^ key) = IndexFromKey;
int IndexFromKey(winrt::hstring const& key);
public int IndexFromKey(string key);
function indexFromKey(key)
Public Function IndexFromKey (key As String) As Integer

参数

key
String

Platform::String

winrt::hstring

要查找索引的项 (键) 的唯一标识符。

返回

Int32

int

具有指定 的项的索引。

注解

在调用此方法之前,请检查 HasKeyIndexMapping 属性是否 为 true 。 如果数据源不支持唯一 ID (键值) ,此方法将导致 NotImplementedException。

适用于