开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜