문제

What is/are the main disadvantage of VirtualizingStackPanel? If it doesn't have any, then why it is not made as a default panel behavior/template in ItemsControl?

도움이 되었습니까?

해결책

The MSDN page on the VirtualizingStackPanel Class has the following statements:

The word "virtualize" refers to a technique by which a subset of user interface (UI) elements are generated from a larger number of data items based on which items are visible on-screen.

and

Virtualization in a StackPanel only occurs when the items control contained in the panel creates its own item containers.

and

VirtualizingStackPanel is the default items host for the ListBox element.

From this it looks like for the "normal" use of a StackPanel as a host for buttons, text blocks etc. virtualisation wouldn't offer any advantages or might even impose a performance overhead. When used in a ListBox virtualisation does have benefits as a) item containers are created by the items control and b) there are likely to be more elements in the list than can be shown on the screen at any one time.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top