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 us开发者_如何学Cing 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?
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!
精彩评论