Navigation
RadWizard provides out of the box a basic sequential page navigation, which allows you to navigate through the pages linearly. With the help of RadWizard's events you can follow the state of the control at run time and implement custom pages sequence and page processing validation if necessary.
Linear Navigation
RadWizard’s navigation is enabled by default and it allows you navigating through the pages in linear order. By default, pages will be visited in the order that they are defined in its WizardPages collection.
Conditional Navigation
RadWizard provides the following events, which enable the implementation of conditional (not linear) navigation.
- SelectionChanging
- SelectionChanged
- Previous
- Next
- Finish
- Help
- Cancel
For the full list of events refer to the Events article.
SelectedPage
The SelectedPage property is of type WizardPage and gets or sets the currently selected page.
Here's an example of handling the SelectionChanged event using the SelectedPage property to jump to a particular page when a condition is met.
Example 1: Jump to particular page
private void RadWizard_SelectionChanged(object sender, SelectedPageChangedEventArgs e)
{
if (e.NewPage == this.page2)
{
((RadWizard)sender).SelectedPage = this.page3;
}
}
Private Sub RadWizard_SelectionChanged(ByVal sender As Object, ByVal e As SelectedPageChangedEventArgs)
If e.NewPage = Me.page2 Then
DirectCast(sender, RadWizard).SelectedPage = Me.page3
End If
End Sub
SelectedPageIndex
The SelectedPageIndex property is of type int and gets or sets the index of the currently selected page.
Example 2 demonstrates how to use the SelectedPageIndex property in the Finish event to return to the starting page once the user clicks Finish.
Example 2: Restart the wizard when the Finish button is clicked
private void RadWizard_Finish(object sender, NavigationButtonsEventArgs e)
{
((RadWizard)sender).SelectedPageIndex = 0;
}
Private Sub RadWizard_Finish(ByVal sender As Object, ByVal e As NavigationButtonsEventArgs)
DirectCast(sender, RadWizard).SelectedPageIndex = 0
End Sub