views:

344

answers:

1

Hi all, I've kind of coded myself into a pickle on this one. I am writing a custom WPF control which is similar to the "TreeListView" described in This MSDN article as well as many other places on the net. A pretty big pile of this thing is custom at this point, and it's meeting my goals fairly well, except on the virtualization front. My overriden treeview and treeviewitem templates both use virtualizingstackpanels to present their items, and I've verified that all of this is getting created as expected. The virtualization works correctly on root level items (only the UI elements for those currently visible in the scrollviewer are cooked up), and the treeview stuff takes care of not generating the elements for collapsed nodes. The problem comes when expanding a node -- all the elements are cooked up for every child in the node, even the thousands that are offscreen.

It seemed to me like all I needed to do was somehow set the scrollowner property of the inner nested virtualizingstackpanels to the same main scrollview that the root level VSP gets hooked up to by default, but I read an MSFT poster here saying that this will not work.

Unfortunately this thing is slow as mud without the virtualization occurring, so I need to come up with some sort of solution. Any suggestions would be greatly appreciated.

A: 

I had a link to a list of what not to do with a virtualizing stackpanel, but for some reason the page comes up blank. Here's another page that talks a little about it:

http://www.designerwpf.com/2008/02/12/listview-and-listbox-performance-issues/

and even links to the one im talking about, but its always blank. if you look on that page its the link to Mark Shurmer's blog. Here's the link if you'd like to try it:

http://itknowledgeexchange.techtarget.com/wpf/listview-is-it-really-too-slow/

Bea Stollnitz also has some articles on it that might help:

Part 1 Part 2 Part 3

If you post some of your code, someone might be able to unravel the spaghetti a bit to help you get to a better implementation.

EDIT: Found a link that might work (thank you archive.org!!!): http://web.archive.org/web/20080104163725/http://itknowledgeexchange.techtarget.com/wpf/listview-is-it-really-too-slow/

Mark Synowiec