I have a very simple wizard that contains 3 pages. The first page should always be shown and is the starting point for the wizard. Now, I have the SelectionChanging event hooked up on the wizard to perform some validation before allowing the user to move on. However, here is where the trick comes in:I would like to be able to skip step two if certain conditions are met and move the user directly to the last page of the wizard. Likewise, as long as this condition is met, if the user then clicks Back to go to the previous step, I'd like to take the user to the first page in this scenario.
I cannot remove the second page of the wizard because this page may be needed in some cases depending on whether the specified criteria is met. Apparently, setting the Wizard's SelectedPage property to the page I want isn't the right way to do it because it puts the wizard into an infinite loop where it keeps going between the first page and the last page because when I set the SelectedPage to the last page, the SelectionChanging event is raised again, but this time with the direction saying Backward which gets the wizard to go back to the first page since the OldPage is now the last page and the direction is Backward and the criteria for skipping the middle step is met, the SelectedPage is set back to the first page which raises the SelectionChanging event with the direction Forward and the OldPage being the first page... and round and round we go.
I'm looking for a solution that doesn't require me to add or remove pages to the collection on the fly and doesn't briefly navigate to the second page in a fashion that it creates a "stutter" to the user where it's obvious that the software is simulating the user clicking the next button when the second page is active.
TIA.