windowsforms-devexpress-dot-xtrawizard-dot-wizardcontrol-b82041c1.md
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
public event WizardCommandButtonClickEventHandler PrevClick
Public Event PrevClick As WizardCommandButtonClickEventHandler
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. |
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.
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;
}
}
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