wpf-115999-controls-and-libraries-navigation-controls-wizard-control-navigation.md
To create a simple wizard with linear page navigation, all you need to do is build a desired sequence of pages and specify which navigation buttons (and when) each page should display. The Wizard will show pages in the exact same order as they are kept within the Items collection, going one page forward or backward as users click Next or Back buttons. You do not need to implement the functionality for these buttons manually.
When end users click navigation buttons, the Wizard.Next, Wizard.Back, Wizard.Cancel and Wizard.Finish events occur. These events fire for both default and custom navigation buttons (see the Custom Buttons section of the Buttons article to learn more). All four events are cancelable. The code sample below illustrates how to implement close confirmation that occurs when end users click the Cancel button.
public MainWindow() {
InitializeComponent();
wizard.Cancel += wizard_Cancel;
}
void wizard_Cancel(object sender, DevExpress.Xpf.Core.CancelRoutedEventArgs e) {
if(ThemedMessageBox.Show("Cancel installation and close wizard?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.No) e.Cancel = true;
}
Public Sub New()
InitializeComponent()
AddHandler wizard.Cancel, AddressOf wizard_Cancel
End Sub
Private Sub wizard_Cancel(ByVal sender As Object, ByVal e As DevExpress.Xpf.Core.CancelRoutedEventArgs)
If ThemedMessageBox.Show("Cancel installation and close wizard?", "Confirmation", MessageBoxButton.YesNo) = MessageBoxResult.No Then
e.Cancel = True
End If
End Sub
To manually select a specific page, use the Wizard’s SelectedItem or SelectedIndex property.