Dynamically Changing Pages

May 9, 2011 at 11:30 AM

Hi

In my wizard, I need to be able to change the pages collection depending on options selected during previous wizard pages.

i.e. say you have a wizard with the following pages :

  • Introduction
  • Select install type
  • Progress
  • Finish

and on the "Select install type" page, you have 2 radiobuttons, "Typical" and "Custom". If the user selects the Typical option, nothing changes. If he selects "Custom", a new page should be added before Progress, where for example he'd be able to specify the installation location.

Is this possible in your solution? Can you just expose the Pages collection, bind a property in the ViewModel to it, and then add/remove pages as required?

Nov 22, 2012 at 9:18 AM
Edited Nov 22, 2012 at 9:21 AM

Hi,

Im wondering the same thing! Have you found a solution yet?

Have you tried using the Visibility property on WizardPages?

Thanx

Coordinator
Nov 28, 2012 at 6:10 PM

Hi.

It's not possible to change the pages collection after the wizard  has been loaded. But you can implement you requirements another way. First, add all the pages you need:

  • Introduction
  • Select install type
  • Installation Location
  • Progress
  • Finish 

Then set the NextPage property of "Select install type" page corresponding to the selected radio button. Alternatively, instead of using NextPage property you can implement a custom INavigationStrategy.

Feb 20, 2013 at 7:44 AM
Hi,

I've found the solution, I know the post is old but I'm hoping it will help someone!

To add a page to the collection dynamically you can use the following:
 Wizard.Pages.Insert(int index, WizardPage page) 
So in your case it would be:
if (Custom.IsChecked)
MyWizard.Pages.Insert(2, MyPage);