This project is read-only.

Large TreeView Lags for 2-4 seconds when loading/unloading page.

Oct 31, 2013 at 5:58 PM

I've been searching all over this forum for information on how to handle this issue but haven't found anything. I'm new to WPF and the Modern UI so I apologize if this question is dumb. I've written a simple 3 page (plus settings page) UI. It works great until I populate a TreeView with my data (which consists of 8146 leaf nodes plus many other non-leaf nodes). I'm using the TreeViewItem object to store each node.

The performance is great when the page is loaded, but if I ask it to switch pages to anything else (settings or one of the other two pages), there's an instantaneous hang of the UI for around 2-4 seconds. The same thing happens when I go back to the page. I assume this is because it's loading all the objects into whatever renders them, but I can't figure out how to handle this problem properly.

I've tried adding these properties to the treeview xaml as recommended on a few forums:


but it had not effect on the problem.

Again, the issue isn't performance while loaded (it's really smooth once it's loaded), it's the performance while loading and unloading (the whole thing just hangs for a few seconds). There are no issues transitioning between any other pages.

I'm fine with the lag time, but I would at least like to be able to display a loading screen and prevent the entire UI from locking up.

Any ideas on how to either speed up these load times or display a loading logo? I'll be happy to post up my code if anyone thinks it will help, but it's really just a very full TreeView on a page in the Modern UI Template in VS 2012.