Edit this page

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

Implementation

Fast and quite easy approach for implementing the built-in commands in RadWizard is to set them directly to a particular RadButton. Thus, once you click a single button, the predefined command will be executed.

There are two major scenarios to define a RadButton – inside and outside RadWizard. The definition will be as follows:

[XAML] Definition of the namespace needed to use the built-in commands of RadWizard

xmlns:wizard="clr-namespace:Telerik.Windows.Controls.Wizard;assembly=Telerik.Windows.Controls.Navigation"

The following example illustrates how to add a RadButton within the FooterTemplate of RadWizard (Example 1).

[XAML] Example 1: Demonstrates how you can use the built-in commands inside RadWizard

<telerik:WizardPage.FooterTemplate>
    <DataTemplate>
            <telerik:RadButton Content="Back" 
                               Width="70" Height="25"
                               Command="wizard:RadWizardCommands.MoveCurrentToPrevious"
                               CommandParameter="{Binding}"/>
    </DataTemplate>
</telerik:WizardPage.FooterTemplate>

Once the source object is defined up in the tree as a DataContext, you can set the source for the CommandParameter Property's Binding to be the entire object.

The other approach is to define the RadButton beyond the boundaries of RadWizard (Example 2).

[XAML] Example 2: Demonstrates how you can use the built-in commands outside RadWizard

<telerik:RadButton Content="Back" 
                   Width="70" 
                   Height="25"
                   Command="wizard:RadWizardCommands.MoveCurrentToPrevious"
                   CommandTarget="{Binding ElementName=myWizard}" />

In this case the target object needs to be explicitly set in the definition of the CommandTarget Property, specifying the RadWizard towards which the command has to be executed. This specific command will be automatically disabled until a change in any of the items in the RadWizard is made.