Wizard Framework for Windows Forms User Guide

Further Integration

Back to Table of Contents

Decision-Based Navigation

A great deal of wizards can be configured using the properties already described: relying on the default page order and customizing where necessary by explicitly setting the PreviousPage and NextPage properties. Sometimes, however, the user's route through the wizard can only be set at runtime once certain variables are known about. The key to controlling this is, again, setting the PreviousPage and NextPage properties. However we provide some extra methods to help make this easier and more maintainable.

Let us take the scenario where on the first page, the user chooses between two options that lead to different paths through the next few pages. There are six pages in total, and of the four middle pages, the first two are to be associated with the first choice and the second two are to be associated with the second choice. The last page always appears. Remember that when activating such a route, the NextPage property of the decision page has to be set, the PreviousPage of the finish page also has to be set, along with the NextPage property of the last page in the "middle pages". A diagram will help illustrate this.

The key to establishing the route at runtime is to handle the BeforeMoveNext event of the decisionPage object, and in its code, use the static Wizard.SetPageOrder method to link all the relevant pages together. This method takes an array of WizardPages which it then links together using their NextPage and PreviousPage properties.Here's the code for the scenario being discussed in this section. It assumes there is a radio button on the decision page called radioDecisionOne.

private void decisionPage_BeforeMoveNext(object sender, System.ComponentModel.CancelEventArgs e)
{
	if (radioDecisionOne.IsChecked == true)
		Wizard.SetPageOrder(new WizardPage[] { decisionPage, d1p1, d1p2, finishPage });
	else
		Wizard.SetPageOrder(new WizardPage[] { decisionPage, d2p1, d2p2, finishPage });
}

Wizard 97 and Aero Wizard

Wizard Framework has the ability to adhere to two specifications: Wizard 97, and Aero Wizard. The Wizard 97 look and feel was used in versions of 32bit Windows released before Windows Vista and the Aero Wizard look is only present in Windows Vista and upwards. However, both specifications can be used on any version of windows. The key to controlling how your wizard looks is the UserExperienceType property of the Wizard class.

The default value of the UserExperienceType property is Automatic. This will cause Wizard Framework to use the Aero Wizard look and feel when your application is running on Windows Vista and upwards, and Wizard 97 otherwise. It is important to remember that because the metrics of Windows elements can change on the fly, and especially when automatic appearance selection is enabled, your pages must have their contents defined in a way such that they support resizing intelligently.

Certain wizard elements are only supported with the Wizard 97 appearance. The concept of a separately-themed start and finish page, and a description for each page, only exists in the Wizard 97 specification. When run with the Aero Wizard look and feel, your start and finish pages will look just like regular pages and any page descriptions simply will not be seen.

Localization

All text shown by the wizard can be fully localized. We expose the English strings through properties on the Wizard class itself. There are PreviousText, NextText, CancelText, FinishText and HelpText properties which are localizable in the standard Windows Forms way.