title: How to add a context menu for only one level in a TreeView
body: <p>I've got a TreeView, containing a number of levels of <code>TreeViewItems</code>.</p>
  
  <p>I would like to add a context menu to only one level of items in the TreeView. However, my code produces a result whereby every single item in the TreeView has a context menu.</p>
  
  <p>This is my code:    </p>
  
  <pre><code>//.... foreach item in this level.... 
  
  {
  ContextMenu cmDatabase = new ContextMenu();
  MenuItem menuItem = new MenuItem();
  menuItem.Header = "Close Connection";
  Image imgMenuIcon = new Image();
  imgMenuIcon.Source = new BitmapImage(new Uri("icon.png"));
  menuItem.Icon = imgMenuIcon;
  cmDatabase.Items.Add(menuItem);
  treeViewItem.ContextMenu = cmDatabase;
  }
  </code></pre>
  
  <p>I've also tried manually setting all the other TreeViewItems' contextMenu property to null.  No luck though.  Any ideas?</p>