title: WPF preventing Popup control to consume click event
body: <p>I have a popup control that appears after a storyboard finishes. This popup is attached to a stackpanel and it is positioned at the bottom.</p>
  
  <p>I have implemented a feature for double click on the stackpanel: When user double click it with mouse left button, the stackpanel slides and disappears.</p>
  
  <pre><code>private void pnlTopMenu_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  </code></pre>
  
  <p>For the popup I have set StaysOpen="False" so popup will hide automatically when user clicks wherever on the window outside the popup. This is the default behavior for popup when StaysOpen property is set to false.</p>
  
  <p>My problem here is that the popup behavior (hide on click) is conflicting with the MouseLeftButtonDown event for the stackpanel.</p>
  
  <p>Within MouseLeftButtonDown I check if e.ClickCount >= 2. If so, I slide the stackpanel and hide it. The stackpanel is shown when user click on a button: a storyboard begins and shows it, after storyboard finishes, popup is also shown for the stackpanel.</p>
  
  <p>So it happens the following.</p>
  
  <ol>
  <li>User click on a button so a storyboard begins and it shows the stackpanel and when storyboard finishes it shows the popup attached to the stackpanel at the bottom of the stackpanel.</li>
  <li>At this point stackpanel and popup is shown. Now, if user double click to hide the stackpanel, when pnlTopMenu_MouseLeftButtonDown is fired,  e.ClickCount >= 2 is not satisfied so panel is not hidden because popup has consumed 1 click to hide itself... so this is a problem for me as stackpanel is not being hidden on double click, so how can I solve this? Is there any way that popup closes without consuming mouse click?</li>
  </ol>