WPF中的堆栈面板和虚拟化堆栈面板有什么区别? [英] What is the difference between a stackpanel and a virtualizingstackpanel in WPF?

查看:222
本文介绍了WPF中的堆栈面板和虚拟化堆栈面板有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WPF中的堆栈面板和虚拟化堆栈面板有什么区别?

What is the difference between a stackpanel and a virtualizingstackpanel in WPF?

推荐答案

VirtualizingStackPanel 可以在处理非常大的集合时提供性能优势.通过仅呈现和处理用户可见的数据子集,而不是处理整个数据列表,可以做到这一点.通过仅为可见项创建UI元素,这可以大大减少其要做的工作量.

A VirtualizingStackPanel can offer performance benefits when working with very large collections. It does so by only rendering and processing a subset of the data which is visible to the user vs. processing the entire list of data. By creating only UI elements for the visible items, this can greatly reduce the amount of work it has to do.

虽然

  1. 您是数据绑定非UI元素或必须在特定面板中为其创建UI的元素
  2. 您正在绑定大量数据

另一方面,StackPanel将为StackPanel中包含的所有元素预先创建控件.

A StackPanel on the other hand, will up front create the controls for all elements contained within the StackPanel.

VirtualizingStackPanel MSDN页面上进行了不错的讨论: http ://msdn.microsoft.com/zh-CN/library/system.windows.controls.virtualizingstackpanel.aspx

The VirtualizingStackPanel MSDN page has a decent discussion: http://msdn.microsoft.com/en-us/library/system.windows.controls.virtualizingstackpanel.aspx

这篇关于WPF中的堆栈面板和虚拟化堆栈面板有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆