Navigation

  • 2 minutes to read

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;
}

To manually select a specific page, use the Wizard's SelectedItem or SelectedIndex property.