Back to Devexpress

WizardControl.PrevClick Event

windowsforms-devexpress-dot-xtrawizard-dot-wizardcontrol-b82041c1.md

latest5.3 KB
Original Source

WizardControl.PrevClick Event

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

Namespace : DevExpress.XtraWizard

Assembly : DevExpress.XtraWizard.v25.2.dll

NuGet Package : DevExpress.Win

Declaration

csharp
public event WizardCommandButtonClickEventHandler PrevClick
vb
Public Event PrevClick As WizardCommandButtonClickEventHandler

Event Data

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

PropertyDescription
HandledGets or sets whether an event was handled.
PageGets 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.

csharp
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;
    }
}
vb
Private pageSkipped As Boolean = False

Private Sub wizardControl1_NextClick(ByVal sender As Object, ByVal e As DevExpress.XtraWizard.WizardCommandButtonClickEventArgs)
    If e.Page = wizardPage1 Then
        Select Case radioGroup1.EditValue.ToString()
            Case ("ToPage2")
                wizardControl1.SelectedPage = wizardPage2
                e.Handled = True
            Case ("ToPage3")
                wizardControl1.SelectedPage = wizardPage3
                e.Handled = True
                pageSkipped = True
            Case ("ToFinalPage")
                wizardControl1.SelectedPage = completionWizardPage1
                e.Handled = True
                pageSkipped = True
        End Select
    End If
End Sub

Private Sub WizardControl1_PrevClick(ByVal sender As Object, ByVal e As DevExpress.XtraWizard.WizardCommandButtonClickEventArgs)
    If pageSkipped Then
        wizardControl1.SelectedPage = wizardPage1
        pageSkipped = False
        e.Handled = True
    End If
End Sub

See Also

NextClick

WizardControl Class

WizardControl Members

DevExpress.XtraWizard Namespace