private void createText(object sender, EventArgs e) { TreeNode selected = tree.SelectedNode; if (selected.Tag is LayerController) { // model LayerController parent = (LayerController)selected.Tag; TextController node = new TextController(new Text()); if (!parent.add(node)) { // failed! TODO } // ui TreeNode added = selected.Nodes.Add(node.getName()); added.Tag = node; selected.Expand(); } }