tags:

views:

286

answers:

0

In my main application window, there are controls, each of which opens a popup that presents more controls to the user.

Other controls in the main application window have mousedoubleclick event handlers. My problem is that when the a user double clicks in the popup, the controls behind the popup are receiving the mousedoubleclick events.

I've tried added a mousedoubleclick event handler to the popup's parent, and handling the event, but it still gets through to the main application window.

    private void ParentControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        e.Handled = true;
    }

I've also tried invoking Popup.CaptureMouse() in a MouseEnter event handler in the popup, but the method always fails (returns false).

    void popup_MouseEnter(object sender, MouseEventArgs e)
    {
        e.Handled = true;
        Popup popup = sender as Popup;
        bool success = popup.CaptureMouse();
    }

Are there any other ways to prevent the mouse events from firing in the main application window when the popup is open?