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.
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.
private void pnlTopMenu_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
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.
My problem here is that the popup behavior (hide on click) is conflicting with the MouseLeftButtonDown event for the stackpanel.
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.
So it happens the following.
- 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.
- 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?