Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How do you write to a specific field in a TreeView in C#?

$
0
0

I have a TreeView:

<TreeView Name="OOB"<!-- etc., -->

And I know which item was clicked on:

  selectedNode = ((XmlNode)treeViewItem.Header);

The TreeView is built from this XML file:

<?xml version="1.0" encoding="UTF-8"?><Army><ArmyName>The Army of Northern Virginia</ArmyName><Commander><CommanderName>The Emperor Napoleon</CommanderName><CommanderLeadership>94</CommanderLeadership><Division><DivisionCommanderName>Major General William T. Sherman</DivisionCommanderName><DivisionCommanderLeadership>78</DivisionCommanderLeadership><Unit><UnitName>Chasseurs à Cheval Garde</UnitName><UnitIcon>Cavalry.png</UnitIcon><UnitType>Cavalry</UnitType><UnitKStrength>3</UnitKStrength><UnitStrength>456</UnitStrength><UnitQuality>94</UnitQuality><UnitMorale>72</UnitMorale><UnitLeadership>74</UnitLeadership><UnitAmmunition>99</UnitAmmunition></Unit><Unit><UnitName>Battery B 4th US Artillery</UnitName><UnitIcon>Artillery.png</UnitIcon><UnitType>Artillery</UnitType><UnitKStrength>3</UnitKStrength><UnitStrength>4456</UnitStrength><UnitQuality>88</UnitQuality><UnitMorale>65</UnitMorale><UnitLeadership>82</UnitLeadership><UnitAmmunition>25</UnitAmmunition></Unit></Division><Division><DivisionCommanderName>Spoons Butler</DivisionCommanderName><DivisionCommanderLeadership>18</DivisionCommanderLeadership><Unit>

... etc.....

And, after a dialog box pops up, I get user input and then disappears I want to put the new value from the dialog box into the field:

<DivisionCommanderLeadership>78</DivisionCommanderLeadership>

(For example, or any specific field for that matter.)

How do I write BACK a value into a specific TreeView field?

Thanks!


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>