In Chapter 5, you learned about routed events, which you can use to respond to a wide range of mouse and keyboard actions. However, events are a fairly low-level ingredient. In a realistic application, functionality is divided into higher-level tasks. These tasks may be triggered by a variety of actions and through a variety of user-interface elements, including main menus, context menus, keyboard shortcuts, and toolbars.
WPF allows you to define these tasks—known as commands—and connect controls to them so you don’t need to write repetitive event-handling code. Even more important, the command feature manages the state of ...