Skip to content

Create a custom wizard experience

David Hall edited this page Apr 29, 2020 · 1 revision

Two Options

  1. Use the 'Custom Wizard Control' template, available as part of the VSIX from this site or from the Visual Studio Marketplace. This creates a single form with a label, buttons and a WizardPageContainer hosting a single page. Everything is hooked together already so this is the easiest option.
  2. Create your own form and add, at least, a WizardPageContainer hosting a single page and movement (Back, Next, Cancel) buttons. More instructions below.

Build your own (Option #2)

  1. To your form, add a WizardPageContainer instance.
  2. Add the buttons you wish the user to see and connect them to the WizardPageContainer instance. All of these are optional if you want to manage navigation of the wizard pages manually.
    • Add the button instance for backwards movement to the form and then set its instance to the WizardPageContainer's BackButton property. Optionally, set the BackButtonText property to the text you wish to display.
    • Add the button instance for forward movement to the form and then set its instance to the WizardPageContainer's NextButton property. Optionally, set the NextButtonText property to the text you wish to display to advance to the next page and the FinishButtonText property to the text you want displayed when the user is on the last page.
    • Add the button instance for canceling the wizard to the form and then set its instance to the WizardPageContainer's CancelButton property. Optionally, set the CancelButtonText property to the text you wish to display.
  3. Custom wizards do not automatically show their title (the Text property's value). If you wish to have a title displayed, add a control to show it. Go to the WizardPageContainer instance and connect a method to the SelectedPageChanged event. In that method, extract the current page’s Text value and give it to your title control.
private void wizardPageContainer1_SelectedPageChanged(object sender, EventArgs e)
{
   headingControl.Text = wizardPageContainer1.SelectedPage.Text;
}
  1. If you wish to perform other actions when the page changes, you can add them to the SelectedPageChanged handler mentioned above. This is how the StepWizardControl handles changing the current step.
  2. Connect to the page events to handle actions within the wizard related to pages (Commit, Rollback, etc.) as described on the Documentation page.
Clone this wiki locally