I implemented a WPF load-on-demand treeview like described in this (very good) article.
In the mentioned solution a dummy element is used to preserve the expand +
After quickly looking into Josh's code, I found this constructor:
protected TreeViewItemViewModel(TreeViewItemViewModel parent, bool lazyLoadChildren)
{
_parent = parent;
_children = new ObservableCollection();
if (lazyLoadChildren)
_children.Add(DummyChild);
}
So, if you pass false
for the lazyLoadChildren
parameter from your inheriting ViewModel classes, the + icon should not appear because the DummyChild is not added. Since you seem to know whether your items have children or not, you should be able to pass the appropriate value for the lazyLoadChildren
property. Or am I missing something?