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 从 system.windows.controls.itemscontrol> ((如 ListBox 或) )使用 ListView 来仅为可见项创建 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.

适用于