开发者

WPF- Is there a performance difference between using a ContentPresenter or a VirtualizingStackPanel as the itemshost in a ListBox ControlTemplate?

开发者 https://www.devze.com 2023-01-11 17:11 出处:网络
The question is prett开发者_如何学Pythony much self-explanatory.Yes, there is. The VirtualizingStackPanel optimizes the display of the items - it only creates and holds the visible items - and thus pr

The question is prett开发者_如何学Pythony much self-explanatory.


Yes, there is. The VirtualizingStackPanel optimizes the display of the items - it only creates and holds the visible items - and thus provides a better performance.

Using another panel can give you extended possibilities in styling and scrolling, but it might be problematic if you have hundrets or thousands of entries.

BTW, if you set the CanContentScroll property to false even the VirtualizingStackPanel will generate all items in order to provide smoother scrolling - the default is to scroll from on item to the next.

0

精彩评论

暂无评论...
验证码 换一张
取 消