title: Mouse events on Treeview
body: <p>I want in the window of a wpf to set a treeview and make use of it through mouse events. Particularly, I would like a complex shape to be drawn on a canvas by a mouseclick on each item of the treeview. However I am not sure if the treeview can serve this purpose, since the implementation I made does not seem to work at all. The mouse events do not work (the delegates are not triggered). Could someone indicate me the reason? Have a look at the code:</p>
  
  <pre><code>&lt;TreeView DockPanel.Dock="Left" Background="DarkGray" HorizontalAlignment="Left" VerticalAlignment="Top"&gt;
      &lt;TreeViewItem Header="Input Data"&gt;
          &lt;TreeViewItem Header="Vector" MouseEnter="create_Rhombus"/&gt;
          &lt;TreeViewItem Header="Array"/&gt;
      &lt;/TreeViewItem&gt;
      &lt;TreeViewItem Header="Maths"&gt;
          &lt;TreeViewItem Header="Add" MouseDown="create_AddRectangle"/&gt;
          &lt;TreeViewItem Header="Subtract" MouseDown="create_SubtractRectangle"/&gt;
          &lt;TreeViewItem Header="Multiply" MouseDown="create_MultiplyRectangle"/&gt;
          &lt;TreeViewItem Header="Divide" MouseDown="create_DivideRectangle"/&gt;
      &lt;/TreeViewItem&gt;
  &lt;/TreeView&gt;
  </code></pre>
  
  <p>The methods in the code behind file are:</p>
  
  <pre><code>private void create_AddRectangle(object sender, MouseButtonEventArgs e)
  
  private void create_SubtractRectangle(object sender, MouseButtonEventArgs e)
  </code></pre>
  
  <p>….</p>
  
  <p>However the above methods are not invoked. Why?</p>