Share via


ItemsRepeater.GetElementIndex(UIElement) Method

Definition

Retrieves the index of the item from the data source that corresponds to the specified UIElement.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

public:
 virtual int GetElementIndex(UIElement ^ element) = GetElementIndex;
int GetElementIndex(UIElement const& element);
public int GetElementIndex(UIElement element);
Public Function GetElementIndex (element As UIElement) As Integer

Parameters

element
UIElement

The element that corresponds to the item to get the index of.

Returns

Int32

int

The index of the item from the data source that corresponds to the specified UIElement, or -1 if the element is not supported.

Remarks

Only UIElements that are direct children of the ItemsRepeater are supported. A value of -1 is returned for unsupported elements.

Applies to

See also