title: Closing ContextMenu by left MouseClick
body: <p>I have a button that opens a ContextMenu after I click on it.</p>
  
  <pre><code>   private void menuButton_Click(object sender, RoutedEventArgs e) {
  
          ((Button)sender).ContextMenu.PlacementTarget = sender as Button;
          ((Button)sender).ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
          ((Button)sender).ContextMenu.IsOpen = true;
  
      }
  </code></pre>
  
  <p>When I click on the button the Menu opens as I want. However, when I click again the menu seems to close and re-open very fast. This, makes it sound like everytime I click with the mouse on the menu button, the menu re-opens and never closes.</p>
  
  <p>I tried:</p>
  
  <pre><code>((Button)sender).ContextMenu.IsOpen = !((Button)sender).ContextMenu.IsOpen;
  </code></pre>
  
  <p>The value of IsOpen becomes false when I press by mouse. Actually I notice that the menu closes every time I click by mouse anywhere on the page(including the button itself). Thus, the IsOpen becomes false.</p>
  
  <p>Is there a clean way of making the mouse click Open and Close the Menu?Is ContextMenu implemented to close if I left-click the mouse?</p>
  
  <p>Thank you</p>