Commands
RadWizard provides a set of built-in commands that enables you to easily handle the User Interface actions, but still make your logic independent of the UI layout.
All supported commands are defined in the RadWizardCommands class and are listed below:
- Cancel
- Finish
- Help
- MoveCurrentToPrevious
- MoveCurrentToNext
Using The RadWizardCommands
In order to utilize the built-in RadWizard commands, you can set them directly to the Command property of a button. Thus, once you click the button, the predefined command will be executed.
There are two major scenarios to define a RadButton – inside and outside RadWizard. The wizard namespace definition is as follows:
Definition of the namespace needed to use the built-in commands of RadWizard
Example 1: Demonstrates how you can use the built-in commands inside RadWizard
The other approach is to define the RadButton beyond the boundaries of RadWizard.
Example 2: Demonstrates how you can use the built-in commands outside RadWizard
Execute RadWizardCommands Programmatically
All RadWizardCommands are of type RoutedUICommand. So, for example, you may easily handle the Click event of a button, and execute your command. However, when invoking the command in such a manner a second parameter should be added, pointing out the target UI Element as shown in Exapmle 3.
Example 3: Executing wizard command from code behind
Custom CommandProvider
RadWizard also exposes a CommandProvider property, which allows you to customize the behavior of the commands in an MVVM-friendly way. Each of the commands listed in the beginning of the article can be customized by overriding its corresponding Execute/CanExecute method. Examples 3 and 4 demonstrate a custom CommandProvider implementation.