Navigate to a specific page with SelectedPageChanging event

Wizard for WPF Forum

Posted 16 years ago by Joe Lozina
Version: 3.5.0421
Avatar
Hi
I would like to navigate to a specific page using the SelectedPageChanging event.
What would be the call to have the next page be changed to the PaymentDetails WizardPage.

   private void wizard_SelectedPageChanging(object sender, WizardSelectedPageChangeEventArgs e)
        {
            if (e.OldSelectedPage == ItemsNeedAction)
            {
                if (actionNowNo.IsChecked == true)
                {
                    //I want to navigate to the PaymentDetails WizardPage here
                   ItemsNeedAction.NextPage = PaymentDetails;  //doesnt work
                }
            }
        }
Thanks
Joe

Comments (7)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

I think you'd want to do something like this:
e.Cancel = true;
wizard.SelectedPage = PaymentDetails;


Actipro Software Support

Posted 16 years ago by Joe Lozina
Avatar
Hi
When I paste that code in, I get "System.StackOverflowException was unhandled" &
"An unhandled exception of type 'System.StackOverflowException' occurred in WindowsBase.dll"

e.Cancel = true; 
wizard.SelectedPage = PaymentDetails; //I get a System.StackOverflowException here
I have also upgraded to the latest version 3.5.425.0
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

Do you have a simple project you could email over that shows this happening? Perhaps we can make a change to allow this sort of thing to work for the next maintenance release.


Actipro Software Support

Posted 16 years ago by Joe Lozina
Avatar
Ive sent a simple project to support, let me know how u go.

[Modified at 04/23/2008 06:08 PM]
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

Strange, we never received it. I wonder if since you sent it from a gmail account it got blocked. I added your email address you registered with us as a safe sender to our mail server. Please try to send it again.


Actipro Software Support

Posted 16 years ago by Joe Lozina
Avatar
I've just resent it. Let me know if you dont get it.
Thanks.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Joe,

Try putting this in there.. it should prevent the recursion your code is causing:
if (e.NewSelectedPage != PaymentDetails) {
   e.Cancel = true;
   wizard.SelectedPage = PaymentDetails;
}
It just checks to see if we are already going to the correct page. If so, there is no need to cancel and set the selected page again, which is what is causing the infinite recursion.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.