WPF C# - XML Edit Binding in Treeview

rmehorrafa

New Member
I think this is a very basic question, but I can't find answer to it.I got an XML file which loaded into a textblock of a treeview using hierarchical data template:\[code\]<HierarchicalDataTemplate.Triggers> <DataTrigger Binding="{Binding Path=NodeType}" Value="http://stackoverflow.com/questions/10428875/Element"> <Setter TargetName="textBlock1" Property="Text" Value="http://stackoverflow.com/questions/10428875/{Binding Path=Name}"/> </DataTrigger></HierarchicalDataTemplate.Triggers>\[/code\]The c# code to open an XML:\[code\]XmlDocument doc = new XmlDocument();doc.Load(open.FileName);XmlDataProvider dp = (XmlDataProvider)this.FindResource("nodes");dp.Document = doc;dp.XPath = "*";\[/code\]When I double click on the textBlock1 a new window appears with a cancel and a save button, and a textbox(what I want to edit) which contains the selected node:\[code\]XmlNode selected_xNode = tree.SelectedItem as XmlNode;openWindow.textBox1.Text = selected_xNode.Name;\[/code\]This works fine, but I don't know how can I change the selected node name to the textbox.text when I click on the save button?I want something similar to this:\[code\]selected_xNode.Name = textBox1.Text;\[/code\]
 
Back
Top