/// <summary>Called when the Back button is clicked. If the event is not canceled, the wizard will navigate to the /// previous step. /// </summary> protected virtual void OnBackButtonClicked(CancelEventArgs e) { if(CurrentStepIndex != -1) CurrentStep.OnBackButtonClicked(e); if(BackButtonClicked != null) BackButtonClicked(this, e); if(!e.Cancel && CurrentStepIndex != -1) { if(DesignMode || CurrentStep.PreviousStep == null) // in design mode, we always want to move through the steps in { // order, so it's predictable and the user can access them all if(CurrentStepIndex > 0) CurrentStepIndex--; } else { CurrentStepIndex = CurrentStep.PreviousStep.Index; } } }