-
Notifications
You must be signed in to change notification settings - Fork 32
Create a custom wizard experience
David Hall edited this page Apr 29, 2020
·
1 revision
- 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. - Create your own form and add, at least, a
WizardPageContainer
hosting a single page and movement (Back, Next, Cancel) buttons. More instructions below.
- To your form, add a
WizardPageContainer
instance. - 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
'sBackButton
property. Optionally, set theBackButtonText
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
'sNextButton
property. Optionally, set theNextButtonText
property to the text you wish to display to advance to the next page and theFinishButtonText
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
'sCancelButton
property. Optionally, set theCancelButtonText
property to the text you wish to display.
- Add the button instance for backwards movement to the form and then set its instance to the
- 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 theWizardPageContainer
instance and connect a method to theSelectedPageChanged
event. In that method, extract the current page’sText
value and give it to your title control.
private void wizardPageContainer1_SelectedPageChanged(object sender, EventArgs e)
{
headingControl.Text = wizardPageContainer1.SelectedPage.Text;
}
- If you wish to perform other actions when the page changes, you can add them to the
SelectedPageChanged
handler mentioned above. This is how theStepWizardControl
handles changing the current step. - Connect to the page events to handle actions within the wizard related to pages (Commit, Rollback, etc.) as described on the Documentation page.