private void createLayer(object sender, EventArgs e) { TreeNode selected = tree.SelectedNode; if (selected.Tag is ContainerController) { // model ContainerController parent = (ContainerController)selected.Tag; LayerController node = new LayerController(new Layer()); parent.add(node); // ui TreeNode added = selected.Nodes.Add(node.getName()); added.Tag = node; selected.Expand(); } }