Is there a command in WPF to close the application from context menu? That is, the same context menu which you get by right clicking on the title bar on any window?
There are loads of standard commands, but I am struggling to find an exit command.
We can close the window either by using "this. Close()"or by using "App. Current. Shutdown()".
A ContextMenu is attached to a specific control. The ContextMenu element enables you to present users with a list of items that specify commands or options that are associated with a particular control, for example, a Button. Users right-click the control to make the menu appear.
Unfortunately this doesn't exist. You'll have to implement a custom command and call
Application.Current.Shutdown();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With