Reputation: 5449
I'd like to implement a WPF Menu
with the same behavior as the Office menus:
When you click on 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?
Upvotes: 0
Views: 948
Reputation: 30418
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.
Upvotes: 1