The Meaning of command:
- In the development process, there will be many buttons to achieve the same function. So you can use command to bind many operations to unified logic.
- Disable/enable controls can be implemented via CanExecute
The four main concepts of command
- Command
- Command Source
- Command Target
- Command Binding
Command: Is the action to be performed. Implemented via the ICommand interface (method: Execute/canexecute, Event: Canexecutechange) Note: The command itself does not contain processing logic. The processing logic is contained in the command binding.
Command Source: Is the object that invokes the command. Implemented through the ICommandSource interface. The main three properties are: Command,command target (the object on which to execute the command), command Parameter (user-defined parameters).
Command Binding: Associates a command with an event handler that implements the command.
command in WPF