Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF : Stop a ContextMenu from closing

Tags:

c#

wpf

A Context Menu automatically closes when the user clicks outside of it. Is there a way to stop it from closing ? I tried setting the StaysOpen property to true but failed to get the desired result.

Thanks for any help!

like image 860
Jojo Sardez Avatar asked Jan 24 '26 04:01

Jojo Sardez


1 Answers

Use ContextMenuClosing event.... "To suppress closing context menus, handlers of the event should mark it as handled" from msdn doc - http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.contextmenuclosing%28VS.90%29.aspx

like image 194
Nash Avatar answered Jan 25 '26 19:01

Nash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!