public void Remove(){ ... ... else if ((NodeType)n.Tag == NodeType.Attribute) //Here I simply check if it's the "special" parent { Commands.CommandAttributeRemove cmd = (Commands.CommandAttributeRemove)mAppData.CommandFactory.Create("AttributeRemove"); cmd.Data = n.Text; cmd.ObjectClass = mObjectClass; cmd.ObjectTypeName = n.Parent.Parent.Text; list.Add(cmd); mNodeToExpand = mTreeView.SelectedNode.Parent; //THIS LINE IS IMPORTANT... mNodeToExpand is a member variable which I use in UpdateData() } ... ... UpdateData(); } public void UpdateData() { … //A lot of not so important stuff happening here (at least not important for what I want, I think) ... //Update Selected Items (for the case that objects were deleted) and UpdateSelection OnSelect(); //UpdateSelection(); this.Update();
if (mNodeToExpand != null) { mNodeToExpand.Expand(); mNodeToExpand = null; } }
Remove()
mTreeView.SelectedNode.Parent.Nodes.Add(new Node("Blabla"));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)