Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close WPF application from context menu?

Tags:

command

wpf

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.

like image 964
Vitalij Avatar asked Oct 05 '10 15:10

Vitalij


People also ask

How do I close an application in WPF?

We can close the window either by using "this. Close()"or by using "App. Current. Shutdown()".

What is context menu WPF?

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.


1 Answers

Unfortunately this doesn't exist. You'll have to implement a custom command and call

Application.Current.Shutdown();
like image 162
Jeremy Avatar answered Sep 19 '22 18:09

Jeremy