title: How can i get the current node from context menu in a TreeView in Powershell?
body: <p>I create a treeview in powershell and i added a context menu into every items.
  I try to get now, when i click on an context menu item, the selected node.</p>
  
  <pre><code>$ctxCreateSiteMenuItem = New-Object System.Windows.Forms.MenuItem
  $ctxCreateSiteMenuItem.Text = "Create a site"        
  $ctxCreateSiteMenuItem.Add_Click({CreateSite $this.Parent.Node})
  </code></pre>
  
  <p>When i looked to $this, it is my current context menu item. $this.Parent this is my list of context menu items. $this.Parent.parent return empty value.
  In c# ou VB the solution is really easy because you have access to the sender but here i can not find a way to do it.
  For information, i right click to open the context menu. I already try to select a node and after open the context menu but it didn't work.</p>
  
  <pre><code>function CreateSite{
  param ( 
              $selectedNode,
              $sender,
              $eargs          
          )
  
  Write-host $sender
  Write-host $eargs
  </code></pre>