ItemsRepeater.TryGetElement(Int32) Method

Definition

Retrieves the realized UIElement that corresponds to the item at the specified index in the data source.

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

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

Parameters

index
Int32

int

The index of the item.

Returns

The UIElement that corresponds to the item at the specified index if the item is realized, or null if the item is not realized.

Remarks

An item is realized when a UIElement has been prepared to display it. Requesting the element for an item that is not realized does not cause it to be realized; instead it is reported as null.

Applies to

See also