![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Binding a TreeView to a large dataset. I have a large XML document that I'm binding to a TreeView for testing purposes. There are relatively few nodes at depth=1 so the tree is displayed quickly. However there are a lot of nodes at depth=2 (200-300 per depth=1 node) and expanding the closed depth=1 nodes causes the UI to freeze whilst the binding occurs. As the freeze happens when I try to expand the node, I'm assuming that the TreeView is 'lazy' binding to the XML data. Here is the XAML (I'm setting the DataContext of the TreeView in code) : <HierarchicalDataTemplate DataType="section" ItemsSource="{Binding XPath=section}"> <TextBlock Text="{Binding XPath=@description}"/> </HierarchicalDataTemplate> <TreeView Name="_sectionTree" ItemsSource="{Binding XPath=/sites/section}" BorderThickness ="0"> I have a few questions. 1) Is it the binding that is freezing the UI? 2) Is there a better way to perform the binding so that the UI does not freeze? 3) If not, are there any events that I can handle do give user feedback before and after the binding occurs? i.e. change the cursor or display a 'loading...' node. Cheers Tom. |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Binding a TreeView to a large dataset. Tom, I'm having a similar problem. I've got a ListBox templated with a HierarchicalDataTemplate. When I bind a couple of hundred items to the list it freezes up the UI, and when I un-bind those and bind a smaller subset, it takes just as long. However going from one small list of items to another small list of items, it does not freeze up the UI. Can anyone shed some light on this? |
My System Specs![]() |
| Thread Tools | |
| |