Menus are not just to add to the application; you need to perform some actions on the menu with a click by adding the Click event handler, as shown in the following code snippet:
<MenuItem Header="E_xit" Click="OnExitMenuClicked" />
In the code behind, implement the handler, as shown in the following code:
private void OnExitMenuClicked(object sender, RoutedEventArgs e) { MessageBox.Show("'Exit' menu item clicked!"); Environment.Exit(0); }
This will first show a message box and then exit the application when the user clicks on the Exit menu item.