public override void SetExpandedWithChildren(TreeViewItem item, bool expand)
{
HashSet<int> source = new HashSet<int>(base.expandedIDs);
HashSet<int> parentsBelow = this.GetParentsBelow(item.id);
if (expand)
{
source.UnionWith(parentsBelow);
}
else
{
source.ExceptWith(parentsBelow);
}
this.SetExpandedIDs(source.ToArray<int>());
}
}