简体   繁体   English

如何在WPF中管理包含非常大数据的列表框?

[英]How can I manage a list box with very large data in WPF?

I have to create a couple of listboxes in a WPF application which are expected to show a large number of items. 我必须在WPF应用程序中创建几个列表框,这些列表框应显示大量项目。 All the data comes from an oracle database. 所有数据均来自oracle数据库。

As I understand, virtualizingstackpanel is applicable for performance in large data display, but I guess it only controls the generation of the listboxitems for optimization. 据我了解,virtualizingstackpanel适用于大数据显示的性能,但我想它只能控制listboxitems的生成以进行优化。 I want to control the RAM too, since I have several of them. 我也想控制RAM,因为我有几个。 I am thinking that an open cursor connection to oracle should serve the purpose of minimzing the RAM, and using virtualizingpanel will optimize the generation of listboxitems. 我认为到oracle的开放游标连接应达到最小化RAM的目的,并且使用virtualizingpanel将优化listboxitems的生成。 But I am not able to figure out how to do it. 但是我不知道该怎么做。

Is there a readymade control or code I could refer to solve this issue? 我可以参考现成的控件或代码来解决此问题吗?

Bad news: I don't think you'll be able to use anything deriving from ItemsControl. 坏消息:我认为您将无法使用来自ItemsControl的任何东西。 It looks like when ItemsSource gets set, the Items collection is made fixed and readonly, so you can't just create your own IEnumerable. 看起来在设置ItemsSource时,Items集合已固定并为只读,因此您不能仅创建自己的IEnumerable。 That means you'll probably end up having to do the data virtualization and UI virtualization yourself. 这意味着您可能最终不得不自己进行数据虚拟化和UI虚拟化。 (see http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemssource.aspx ) (请参阅http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemssource.aspx

That being said, you could probably do some tricks with wrappers around your objects. 话虽这么说,您可能可以对对象周围的包装器做一些技巧。 For example, if you retrieved a count, you could probably make a lightweight list of wrapper objects. 例如,如果检索到一个计数,则可能可以制作包装对象的轻量级列表。 The wrapper objects would contain a custom getter/setter property that would access the cursor. 包装对象将包含一个自定义的getter / setter属性,该属性将访问游标。 I don't think that would be too hard to make. 我认为这样做不会太难。

Good news: it looks like Telerik might have some controls of interest - http://blogs.telerik.com/blogs/posts/10-10-20/data_virtualization_for_your_silverlight_and_wpf_applications.aspx - if you're willing to pay. 好消息:如果您愿意付款,Telerik可能会对某些控件感兴趣-http: //blogs.telerik.com/blogs/posts/10-10-20/data_virtualization_for_your_silverlight_and_wpf_applications.aspx

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM