Share via


VirtualizingLayoutContext.GetOrCreateElementAtCore 方法

定義

在衍生類別中實作時,擷取 UIElement ,表示使用指定選項在指定索引找到之來源中的數據項。

protected:
 virtual UIElement ^ GetOrCreateElementAtCore(int index, ElementRealizationOptions options) = GetOrCreateElementAtCore;
UIElement GetOrCreateElementAtCore(int const& index, ElementRealizationOptions const& options);
protected virtual UIElement GetOrCreateElementAtCore(int index, ElementRealizationOptions options);
function getOrCreateElementAtCore(index, options)
Protected Overridable Function GetOrCreateElementAtCore (index As Integer, options As ElementRealizationOptions) As UIElement

參數

index
Int32

int

要為其擷取 UIElement 的數據項索引。

options
ElementRealizationOptions

指定是否要隱藏擷取項目的自動回收,還是強制建立新元素。

傳回

表示數據項的 UIElement

備註

GetOrCreateElementAt (System.Int32) GetOrCreateElementAt (System.Int32,Microsoft.UI.Xaml.Controls.ElementRealizationOptions) 呼叫此方法。

當您要求指定索引的專案時,您可以選擇性地指定是否要隱藏擷取項目的自動回收,還是強制建立新元素。 自動回收所擷取的元素會隱藏 (SuppressAutoRecycle) 會被自動回收邏輯忽略,以清除未擷取為目前版面配置階段一部分的實現專案。 您必須將這些項目傳遞至 RecycleElementCore (Microsoft.UI.Xaml.UIElement) 方法來明確回收這些專案,以避免記憶體流失。

這些選項適用於更進階的配置,這些配置會選擇明確地管理元素的實現和回收作為效能優化。

適用於