void AddItem(TreeLayerNode node) { layerTree.BeginUpdate(); if (layerTree.SelectedNode != null) { Node n = layerTree.SelectedNode.Tag as Node; if (n.IsLeaf) { node.SetParent(n.Parent, n.Index); } else { node.SetParent(n); } layerTree.SelectedNode.Expand(); } else { node.SetParent(model.Root); } layerTree.EndUpdate(); }
void GenerateSample() { layerTree.BeginUpdate(); for (int i = 0; i < 2; i++) { TreeLayerNode node = new TreeLayerNode(this, new LayerFolder("Folder " + i, Editor)); node.SetParent(model.Root); for (int j = 0; j < 3; j++) { TreeLayerNode layer = new TreeLayerNode(this, new Layer("Layer " + i + "." + j, Editor)); layer.SetParent(node); } } layerTree.EndUpdate(); }