如何在 WPF 中管理包含大量数据的列表框?
我必须在 WPF 应用程序中创建几个列表框,预计它们会显示大量项目。所有数据均来自oracle数据库。
据我了解,virtualizingstackpanel适用于大数据显示的性能,但我猜它只是控制列表框项目的生成以进行优化。我也想控制 RAM,因为我有几个 RAM。我认为与 Oracle 的开放游标连接应该达到最小化 RAM 的目的,并且使用 virtualizingpanel 将优化列表框项目的生成。但我不知道该怎么做。
有现成的控件或代码可以参考解决这个问题吗?
I have to create a couple of listboxes in a WPF application which are expected to show a large number of items. All the data comes from an oracle database.
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. I want to control the RAM too, since I have several of them. 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. 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
坏消息:我认为您将无法使用从 ItemsControl 派生的任何内容。看起来当 ItemsSource 设置时,Items 集合将被固定且只读,因此您不能只创建自己的 IEnumerable。这意味着您最终可能必须自己进行数据虚拟化和 UI 虚拟化。 (请参阅http://msdn.microsoft.com /en-us/library/system.windows.controls.itemscontrol.itemssource.aspx)
话虽如此,您可能可以使用对象周围的包装器来实现一些技巧。例如,如果您检索了一个计数,您可能可以创建一个包装对象的轻量级列表。包装对象将包含一个可以访问游标的自定义 getter/setter 属性。我认为这不会太难做。
好消息:看起来 Telerik 可能有一些感兴趣的控件 - http ://blogs.telerik.com/blogs/posts/10-10-20/data_virtualization_for_your_silverlight_and_wpf_applications.aspx - 如果您愿意付费。
祝你好运!
Bad news: I don't think you'll be able to use anything deriving from 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. That means you'll probably end up having to do the data virtualization and UI virtualization yourself. (see 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. 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.
Good luck!