title: Have Context Menu close on mouseclick outside C#
body: <p>I have a listener on the mouse right click event that fires off <code>CreateContextMenu()</code></p>
  
  <p>The function looks like this:</p>
  
  <pre><code>protected virtual ContextMenu CreateContextMenu()
      {
          ContextMenu contextMenu = new ContextMenu();
  
          MenuItem ClickHereMenuItem = new MenuItem();
          ClickHereMenuItem.Header = "Click Here";
          ClickHereMenuItem.Tag = contextMenu;
          ClickHereMenuItem.Click += ClickHere_Click;
  
          contextMenu.Items.Add(ClickHereMenuItem);
  
          contextMenu.Items.Add(new Separator());
  
          //Cancel Menu Item
          MenuItem cancelMenuItem = new MenuItem();
          cancelMenuItem.Header = "Cancel";
          cancelMenuItem.Tag = contextMenu;
          cancelMenuItem.Click += cancelMenuItem_Click;
  
          contextMenu.Items.Add(cancelMenuItem);
          return contextMenu; 
      }
  </code></pre>
  
  <p>Everything works as intended, but the only way the context menu closes is if you select the 'Cancel' menu item (which just sets <code>contextMenu.IsOpen = false</code>). I also want the menu to close if the user click outside of the Control.  How can I accomplish this?</p>