The command discussed here is the command mode in the design mode: The command mode is the behavior mode of the object [gof95 ]. The command mode is also called action mode or transaction mode. In command mode, a request or operation is encapsulated into an object. The command mode allows the system to parameterize the client using different requests, queue requests or record request logs, and provides command revocation and recovery functions.
In our daily application operations, we often need to process various commands and related event processing, such as copying and pasting content in the text box, you may need to return to the previous page to view the corresponding content. When we play videos and multimedia, we may need to adjust the volume and quickly drag to the clip we want to see. In winform programming, we often use various controls to solve such problems. Of course, we must also write a bunch of code to process various commands and events. Windows Presentation Foundation (WPF), as Microsoft's next-generation graphics and Image Support System, is automatically integrated with many controls. For example, the textbox provides copy, paste, cut, undo, and redo commands. WPF provides command sets used by common applications. Common command sets include applicationcommands, componentcommands, navigationcommands, mediacommands, and editingcommands.
WPF saves developers the need to write a lot of code, such as common copy, paste, cut... and other functions. If the requirement is not met, You can implement the icommand interface by yourself. This interface belongs to the system. Windows. Input namespace in the Assembly presentationcore. dll. The built-in WPF command types are routedcommand and routeduicommand. Do these commands meet your requirements? In fact, there are still many deficiencies in the built-in command of WPF, therefore, in the prism project of the mode and practice team, we also created a set of our own commands, especially the coupling with UI elements and the combination of unsupported commands. Therefore, they added another set of commands in Prism: delegatecommand and compositecommand.
Delegatecommand: implements the icommand interface of WPF/Silverlight, and supports only one canexecute and execute hook. However, it implements an interface called iactiveaware to indicate whether the interface is in the set state, non-active delegatecommand is never executed.
Compositecommand: it is also an implementation of the icommand interface of WPF/Silverlight, but it is also a combination of delegatecommand, which can be registered or canceled to delegatecommand, when all built-in delegatecommands in the active state can be executed, canexecute returns true.
References
Understanding routing events and commands in WPF: http://msdn.microsoft.com/zh-cn/magazine/cc785480.aspx
[Prism] Composite Application Guidance for WPF (9) -- command: http://www.cnblogs.com/zhouyinhui/archive/2008/10/25/1319484.html