This repository was archived by the owner on May 7, 2022. It is now read-only.

Description
Hello
Thanks for this code. I am trying to use it in a game map development tool and have run into trouble. The following sequence of events shows the error:
- I select an item programmatically, outside the TreeView (i.e. not by clicking in the treeview ) that isn't loaded and whose parent also is unloaded.
- I expand that same, selected item which brings it into view by setting the IsExpanded property, not clicking in the TreeView (the parents are all expanded)
- I try to deselect the item again (still not using the TreeView) - it is not deselected in the TreeView
It is as if the connection between the ViewModel item and the Tree Item has been lost.
The same procedure works as expected if the parent is loaded and the item is unloaded.
Attached, I have added to the MainWindow (of the Demo project) a few more buttons and items to illustrate this. The three buttons "Extra tree selection", "Extra tree deselection" and "Extra tree expansion" are attached to item 131 and it works. The same set of buttons with L3 in the end of their names are attached to item 1321 (which I have added). Clicking them in the above described order illustrates the problem. If the items and parents are expanded in the TreeView the behavior is as expected.
Best regards
/Fredrik
MainWindow.zip