Hello, currently we are using in our product TreeListView for WPF and we have big problem when navigating through huge tree.
Our test case contains about 5000 nodes with maximum 6 nesting depth.
Tree looks like:
groupA
subgroupA1
subgroupA11
variableA111
index0
index0.0
index0.1
index1
variableA112
subgroupA2
variableA21
groupB
subgroupB1
variableB1
variableB2
groupC
subgroupC1
variableC1
variableC2
groupD
subgroupD1
variableD1
group B,C,D can contains 1000 nodes in each subgroup. Indexes created dynamically when navigating by tree, and depends on metadata of each variable.
Also class VariableTreeListBoxItemAdapter : TreeListBoxItemAdapter is using for better performance, with override
public override IEnumerable GetChildren(TreeListBox ownerControl, object item)
{
var model = item as VarsTreeItem;
return model != null ? model.Children : null
}
VarsTreeItem:
public ObservableCollection<VarsTreeItemBase> Children
{
get
{
if (_children == null)
if (VarMetadata != null)
MakeChildren();
return _children;
}
}
The actual problem that binding to SelectedItem in TreeListView from AutoCompleteBox calls GetChildren() from VariableTreeListBoxItemAdapter for all 5000 nodes that created before selected if try to select last node in tree from AutoCompleteBox collection. And this call takes more than 50 seconds in UI thread. If node selected from first group the delay is not so big, and not visible by user.
VarsTreeItemBase.Children property used lazy loading and created elements only for groups and subgroups. Subtree for any variable created in Children property. So when user try to expand elements subtree creates dynamically and fast.
But when user select last item or in the middle of tree from AutoCompleteBox creating of 5000 previous elements in tree is too slow and hangs UI thread using TreeListBoxItemAdapter.
Could you suggest how i can fix the issue?
[Modified 4 years ago]