tags:

views:

222

answers:

1

I'd like to implement a WPF menu with the same behavior as the Office menus:

When you click away when the menu, it closes the menu but the clicked element does not receive a MouseDown event.

I thought of a couple of ways to do this but they are horribly complex.

Is there a relatively easy way to accomplish this?

+1  A: 

You could always handle the PreviewMouseDown event for your Window. In the handler, if your menu is open, close it and set MouseButtonEventArgs.Handled to true, preventing the event from being sent to whatever control was under the mouse.

Andy
This does not work because the menu is closed before the PreviewMouseDown event is fired
tom greene