title: How to add WPF treeView Node Click event to get the node value
body: <p>I have a <code>TreeView</code> in <code>WPF</code>. Now I want to get the <code>TreeView</code> node click event so that I can get the value of the node on which the user has clicked.
  Here is the Code:</p>
  <pre><code>&lt;Grid Height=&quot;258&quot; Width=&quot;275&quot;&gt;
      &lt;TreeView Height=&quot;258&quot; HorizontalAlignment=&quot;Left&quot; Name=&quot;treeView1&quot; VerticalAlignment=&quot;Top&quot; Width=&quot;275&quot;&gt;    
      &lt;/TreeView&gt;
  &lt;/Grid&gt;
  </code></pre>
  <p>I have populated this <code>TreeView</code> from the C# code. What event methode do I need to write into c# code to get the value of clicked node by the user in my c# code.</p>
  <p>Please help me.</p>
  <p>Here is the c#.</p>
  <pre><code>TreeViewItem treeItem = null;
  treeItem = new TreeViewItem();
  treeItem.Header = &quot;Name&quot;;
  </code></pre>
  <p>Like this, I have populated the TreeView.</p>