public void AddToTree(TreeItem item, Idstring pck = null) { foreach (KeyValuePair <string, IChild> entry in this._children) { if (entry.Value is IParent) { IParent _entry = entry.Value as IParent; if (pck != null && !_entry.ContainsAnyBundleEntries(pck)) { continue; } TreeItem treeItem = new TreeItem() { Text = entry.Key, Image = this.Icon, Tag = entry.Value }; item.Children.Add(treeItem); _entry.AddToTree(treeItem, pck); } } }