VirtualizingStackPanel.SetIsVirtualizing(DependencyObject, Boolean) 方法

定義

設定 IsVirtualizingProperty 附加屬性的值。Sets the value of the IsVirtualizingProperty attached property.

public:
 static void SetIsVirtualizing(System::Windows::DependencyObject ^ element, bool value);
public static void SetIsVirtualizing (System.Windows.DependencyObject element, bool value);
static member SetIsVirtualizing : System.Windows.DependencyObject * bool -> unit
Public Shared Sub SetIsVirtualizing (element As DependencyObject, value As Boolean)

參數

element
DependencyObject

要在其中設定附加屬性值的物件。The object to which the attached property value is set.

value
Boolean

如果 VirtualizingStackPanel 正在虛擬化,則為 true,否則為 falsetrue if the VirtualizingStackPanel is virtualizing; otherwise, false.

備註

標準版面配置系統會建立專案容器,並針對與清單控制項相關聯的每個專案計算版面配置。The standard layout system creates item containers and computes layout for each item associated with a list control. 「虛擬化」一詞指的是一種技術,其中會根據畫面上可見的專案,從大量資料項目產生 UI 元素的子集。The word "virtualize" refers to a technique by which a subset of UI elements are generated from a larger number of data items based on which items are visible on-screen. 當畫面上只有少數專案時,產生許多 UI 元素可能會對應用程式的效能造成不良影響。Generating many UI elements when only a few elements might be on the screen can adversely affect the performance of your application. VirtualizingStackPanel 計算可見專案的數目,並使用 ItemContainerGenerator 來自 ItemsControl (例如 ListBoxListView) ,只針對可見的專案建立 UI 元素。The VirtualizingStackPanel calculates the number of visible items and works with the ItemContainerGenerator from an ItemsControl (such as ListBox or ListView) to create UI elements only for visible items.

適用於