ItemsRepeater.GetOrCreateElement(Int32) 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 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 ^ GetOrCreateElement(int index) = GetOrCreateElement;
UIElement GetOrCreateElement(int const& index);
public UIElement GetOrCreateElement(int index);
Public Function GetOrCreateElement (index As Integer) As UIElement
Parameters
- index
-
Int32
int
The index of the item.
Returns
A UIElement that corresponds to the item at the specified index. If the item is not realized, a new UIElement is created.
Remarks
This method does two things:
- Gets a UIElement that corresponds to the item in the data source at the specified index. If necessary, this method causes a virtualized item to be realized and creates a new UIElement for it.
- Queues that element on the next layout pass as the suggested anchor for the layout to use as a starting point.