Skip to main content

WizardControl.PrevClick Event

Fires after the Back button has been clicked and allows you to cancel the operation.

Namespace: DevExpress.XtraWizard

Assembly: DevExpress.XtraWizard.v24.1.dll

NuGet Package: DevExpress.Win

Declaration

public event WizardCommandButtonClickEventHandler PrevClick

Event Data

The PrevClick event's data class is WizardCommandButtonClickEventArgs. The following properties provide information specific to this event:

Property Description
Handled Gets or sets whether an event was handled.
Page Gets the processed wizard page. Inherited from WizardPageEventArgs.

Remarks

By default, clicking the Back button automatically navigates an end-user to the previous wizard page within the WizardControl.Pages collection. Once clicked, the PrevClick event is raised, which allows you to cancel the operation by setting the WizardCommandButtonClickEventArgs.Handled parameter to true. The current page is returned by the event parameter’s WizardPageEventArgs.Page property.

To learn more, see Page Events.

Example

In the following sample, a Wizard Control has 5 pages:

The code below illustrates how to navigate to a correct page depending on a choice a user makes in the second page.

bool pageSkipped = false;

private void wizardControl1_NextClick(object sender, DevExpress.XtraWizard.WizardCommandButtonClickEventArgs e)
{
    if (e.Page == wizardPage1)
    {
        switch (radioGroup1.EditValue.ToString())
        {
            case ("ToPage2"):
                wizardControl1.SelectedPage = wizardPage2;
                e.Handled = true;
                break;
            case ("ToPage3"):
                wizardControl1.SelectedPage = wizardPage3;
                e.Handled = true;
                pageSkipped = true;
                break;
            case ("ToFinalPage"):
                wizardControl1.SelectedPage = completionWizardPage1;
                e.Handled = true;
                pageSkipped = true;
                break;
        }
    }
}

private void WizardControl1_PrevClick(object sender, DevExpress.XtraWizard.WizardCommandButtonClickEventArgs e)
{
    if (pageSkipped)
    {
        wizardControl1.SelectedPage = wizardPage1;
        pageSkipped = false;
        e.Handled = true;
    }
}
See Also