ItemsRepeater.GetElementIndex(UIElement) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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.