Menu Commands
The Menu control also supports MVVM-style commanding, which requires no event handlers at all.
To use the Menu control with commands, set the Menu's command property to an object with two methods:
- canExecuteCommand: This method takes an argument that represents a parameter and returns a Boolean value indicating whether the command can be executed in the current application state.
- executeCommand: This method takes an argument that represents a parameter and executes the command.
For example, the InputNumber below shows a tax value that can be edited directly or by using menu commands. Notice how some commands are automatically disabled depending on the current tax value: